mage-engine 3.23.44 → 3.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mage.js +1291 -384
  2. package/package.json +1 -2
package/dist/mage.js CHANGED
@@ -4770,7 +4770,7 @@ function interpret(machine, options) {
4770
4770
  respond: respond,
4771
4771
  forwardTo: forwardTo,
4772
4772
  escalate: escalate
4773
- };var index$3=/*#__PURE__*/Object.freeze({__proto__:null,actions:actions,matchesState:matchesState,mapState:mapState,get ActionTypes(){return ActionTypes$1},get SpecialTargets(){return SpecialTargets},assign:assign,doneInvoke:doneInvoke,forwardTo:forwardTo,send:send,sendParent:sendParent,sendUpdate:sendUpdate,State:State,StateNode:StateNode,Machine:Machine,createMachine:createMachine,Interpreter:Interpreter,interpret:interpret,spawn:spawn,matchState:matchState});// threejs.org/license
4773
+ };var index$2=/*#__PURE__*/Object.freeze({__proto__:null,actions:actions,matchesState:matchesState,mapState:mapState,get ActionTypes(){return ActionTypes$1},get SpecialTargets(){return SpecialTargets},assign:assign,doneInvoke:doneInvoke,forwardTo:forwardTo,send:send,sendParent:sendParent,sendUpdate:sendUpdate,State:State,StateNode:StateNode,Machine:Machine,createMachine:createMachine,Interpreter:Interpreter,interpret:interpret,spawn:spawn,matchState:matchState});// threejs.org/license
4774
4774
  const REVISION = '126';
4775
4775
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
4776
4776
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -53738,6 +53738,7 @@ const DEPRECATIONS = {
53738
53738
  const IMPORTER_ERROR_ELEMENT_CREATION = `${PREFIX} Error while creating element: `;
53739
53739
  const IMPORTER_ERROR_LIGHT_CREATION = `${PREFIX} Error while creating light: `;
53740
53740
  const IMPORTER_ERROR_SOUND_CREATION = `${PREFIX} Error while creating sound: `;
53741
+ const IMPORTER_ERROR_PARTICLE_CREATION = `${PREFIX} Error while creating particle emitter: `;
53741
53742
  const IMPORTER_ERROR_UNKNOWN_ELEMENT_SUBTYPE = `${PREFIX} Unknown element subtype: `;
53742
53743
  const ONCREATE_NOT_AVAILABLE = `${PREFIX} Your scene needs a onCreate method.`;
53743
53744
  const PATH_NOT_FOUND = `${PREFIX} can't find requested path`;
@@ -54737,7 +54738,7 @@ let Keyboard = /*#__PURE__*/function (_EventDispatcher) {
54737
54738
  UNKNOWN: "UNKNOWN"
54738
54739
  };
54739
54740
  const FLAT_ENTITY_TYPES = [ENTITY_TYPES.SCENE.TYPE, ENTITY_TYPES.CAMERA.TYPE, ENTITY_TYPES.MESH.TYPE, ENTITY_TYPES.LABEL.TYPE, ENTITY_TYPES.LIGHT.TYPE, ENTITY_TYPES.AUDIO.TYPE, ENTITY_TYPES.MODEL.TYPE, ENTITY_TYPES.SPRITE.TYPE, ENTITY_TYPES.PARTICLE.TYPE, ENTITY_TYPES.SCENERY.TYPE, ENTITY_TYPES.HELPER.TYPE, ENTITY_TYPES.UNKNOWN];
54740
- const FLAT_ENTITY_SUBTYPES = [ENTITY_TYPES.SCENE.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.MAIN, ENTITY_TYPES.CAMERA.SUBTYPES.GAME, ENTITY_TYPES.MESH.SUBTYPES.DEFAULT, ENTITY_TYPES.MESH.SUBTYPES.BOX, ENTITY_TYPES.MESH.SUBTYPES.SPHERE, ENTITY_TYPES.MESH.SUBTYPES.PLANE, ENTITY_TYPES.MESH.SUBTYPES.CYLINDER, ENTITY_TYPES.MESH.SUBTYPES.CONE, ENTITY_TYPES.MESH.SUBTYPES.CUBE, ENTITY_TYPES.MESH.SUBTYPES.LINE, ENTITY_TYPES.MESH.SUBTYPES.CURVE_LINE, ENTITY_TYPES.MESH.SUBTYPES.AXES, ENTITY_TYPES.MESH.SUBTYPES.GRID, ENTITY_TYPES.MESH.SUBTYPES.TARGET, ENTITY_TYPES.LABEL.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.AMBIENT, ENTITY_TYPES.LIGHT.SUBTYPES.SUN, ENTITY_TYPES.LIGHT.SUBTYPES.HEMISPHERE, ENTITY_TYPES.LIGHT.SUBTYPES.POINT, ENTITY_TYPES.LIGHT.SUBTYPES.SPOT, ENTITY_TYPES.AUDIO.SUBTYPES.DEFAULT, ENTITY_TYPES.AUDIO.SUBTYPES.DIRECTIONAL, ENTITY_TYPES.AUDIO.SUBTYPES.AMBIENT, ENTITY_TYPES.MODEL.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.ANIMATED_SPRITE, ENTITY_TYPES.PARTICLE.SUBTYPES.DEFAULT, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER, ENTITY_TYPES.PARTICLE.SUBTYPES.SYSTEM, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER_GROUP, ENTITY_TYPES.PARTICLE.SUBTYPES.PROTON_EMITTER, ENTITY_TYPES.SCENERY.SUBTYPES.DEFAULT, ENTITY_TYPES.SCENERY.SUBTYPES.SKY, ENTITY_TYPES.SCENERY.SUBTYPES.SKYBOX, ENTITY_TYPES.HELPER.SUBTYPES.GRID, ENTITY_TYPES.HELPER.SUBTYPES.AXES, ENTITY_TYPES.HELPER.SUBTYPES.HELPER_SPRITE];
54741
+ const FLAT_ENTITY_SUBTYPES = [ENTITY_TYPES.SCENE.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.DEFAULT, ENTITY_TYPES.CAMERA.SUBTYPES.MAIN, ENTITY_TYPES.CAMERA.SUBTYPES.GAME, ENTITY_TYPES.MESH.SUBTYPES.DEFAULT, ENTITY_TYPES.MESH.SUBTYPES.BOX, ENTITY_TYPES.MESH.SUBTYPES.SPHERE, ENTITY_TYPES.MESH.SUBTYPES.PLANE, ENTITY_TYPES.MESH.SUBTYPES.CYLINDER, ENTITY_TYPES.MESH.SUBTYPES.CONE, ENTITY_TYPES.MESH.SUBTYPES.CUBE, ENTITY_TYPES.MESH.SUBTYPES.LINE, ENTITY_TYPES.MESH.SUBTYPES.CURVE_LINE, ENTITY_TYPES.MESH.SUBTYPES.AXES, ENTITY_TYPES.MESH.SUBTYPES.GRID, ENTITY_TYPES.MESH.SUBTYPES.TARGET, ENTITY_TYPES.LABEL.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.DEFAULT, ENTITY_TYPES.LIGHT.SUBTYPES.AMBIENT, ENTITY_TYPES.LIGHT.SUBTYPES.SUN, ENTITY_TYPES.LIGHT.SUBTYPES.HEMISPHERE, ENTITY_TYPES.LIGHT.SUBTYPES.POINT, ENTITY_TYPES.LIGHT.SUBTYPES.SPOT, ENTITY_TYPES.AUDIO.SUBTYPES.DEFAULT, ENTITY_TYPES.AUDIO.SUBTYPES.DIRECTIONAL, ENTITY_TYPES.AUDIO.SUBTYPES.AMBIENT, ENTITY_TYPES.MODEL.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.DEFAULT, ENTITY_TYPES.SPRITE.SUBTYPES.ANIMATED_SPRITE, ENTITY_TYPES.PARTICLE.SUBTYPES.DEFAULT, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER, ENTITY_TYPES.PARTICLE.SUBTYPES.SYSTEM, ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER_GROUP, ENTITY_TYPES.PARTICLE.SUBTYPES.PROTON_EMITTER, ENTITY_TYPES.PARTICLE.SUBTYPES.FIRE, ENTITY_TYPES.PARTICLE.SUBTYPES.EXPLOSION, ENTITY_TYPES.PARTICLE.SUBTYPES.TRAIL, ENTITY_TYPES.PARTICLE.SUBTYPES.RAIN, ENTITY_TYPES.PARTICLE.SUBTYPES.SNOW, ENTITY_TYPES.PARTICLE.SUBTYPES.FOUNTAIN, ENTITY_TYPES.SCENERY.SUBTYPES.DEFAULT, ENTITY_TYPES.SCENERY.SUBTYPES.SKY, ENTITY_TYPES.SCENERY.SUBTYPES.SKYBOX, ENTITY_TYPES.HELPER.SUBTYPES.GRID, ENTITY_TYPES.HELPER.SUBTYPES.AXES, ENTITY_TYPES.HELPER.SUBTYPES.HELPER_SPRITE];
54741
54742
  const ENTITY_EVENTS = {
54742
54743
  DISPOSE: "DISPOSE",
54743
54744
  STATE_MACHINE: {
@@ -55592,6 +55593,10 @@ const TAGS = {
55592
55593
  SOUNDS: {
55593
55594
  HELPER: "TAGS.SOUNDS.HELPER",
55594
55595
  HOLDER: "TAGS.SOUNDS.HOLDER"
55596
+ },
55597
+ PARTICLES: {
55598
+ HELPER: "TAGS.PARTICLES.HELPER",
55599
+ HOLDER: "TAGS.PARTICLES.HOLDER"
55595
55600
  }
55596
55601
  };var lib_constants=/*#__PURE__*/Object.freeze({__proto__:null,ALMOST_ZERO:ALMOST_ZERO,UP:UP$1,DOWN:DOWN$1,LEFT:LEFT,RIGHT:RIGHT,FRONT:FRONT,BACK:BACK,VECTOR_UP:VECTOR_UP,VECTOR_DOWN:VECTOR_DOWN,VECTOR_LEFT:VECTOR_LEFT,VECTOR_RIGHT:VECTOR_RIGHT,VECTOR_FRONT:VECTOR_FRONT,VECTOR_BACK:VECTOR_BACK,ORIGIN:ORIGIN,ZERO_QUATERNION:ZERO_QUATERNION,MATERIALS:MATERIALS,TEXTURES:TEXTURES,PROPERTIES:PROPERTIES,MATERIAL_PROPERTIES_DEFAULT_VALUES:MATERIAL_PROPERTIES_DEFAULT_VALUES,DEFAULT_MATERIAL_PROPERTIES:DEFAULT_MATERIAL_PROPERTIES,MATERIAL_PROPERTIES_MAP:MATERIAL_PROPERTIES_MAP,MATERIAL_TEXTURE_MAP:MATERIAL_TEXTURE_MAP$1,UNDESIRED_SERIALISED_MATERIAL_PROPERTIES:UNDESIRED_SERIALISED_MATERIAL_PROPERTIES,EFFECTS:EFFECTS,COLLISION_EVENT:COLLISION_EVENT,COLORS:COLORS,ASSETS_TYPES:ASSETS_TYPES,OUTPUT_ENCODINGS:OUTPUT_ENCODINGS,DEFAULT_OUTPUT_ENCODING:DEFAULT_OUTPUT_ENCODING,ROOT:ROOT,DIVIDER:DIVIDER,HASH:HASH,EMPTY:EMPTY$2,QUERY_START:QUERY_START,DEFAULT_SELECTOR:DEFAULT_SELECTOR,BEFORE_UNLOAD:BEFORE_UNLOAD,HASH_CHANGE:HASH_CHANGE,TAGS:TAGS});const buildAssetId = (name, level) => level ? `${level}_${name}` : name;
55597
55602
  const isLevelName = level => level.startsWith(DIVIDER);/**
@@ -56835,11 +56840,15 @@ var Physics$1 = new Physics();let Scene = /*#__PURE__*/function () {
56835
56840
  }, {
56836
56841
  key: "updateChildren",
56837
56842
  value: function updateChildren() {
56838
- for (let i in this.scene.children) {
56839
- if (this.scene.children[i].material) {
56840
- this.scene.children[i].material.needsUpdate = true;
56843
+ this.scene.traverse(child => {
56844
+ if (child.material) {
56845
+ if (Array.isArray(child.material)) {
56846
+ child.material.forEach(m => m.needsUpdate = true);
56847
+ } else {
56848
+ child.material.needsUpdate = true;
56849
+ }
56841
56850
  }
56842
- }
56851
+ });
56843
56852
  }
56844
56853
  }, {
56845
56854
  key: "add",
@@ -58204,7 +58213,7 @@ function applyMiddleware() {
58204
58213
 
58205
58214
  var thunk = createThunkMiddleware();
58206
58215
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
58207
- var version$1 = "3.23.44";
58216
+ var version$1 = "3.24.0";
58208
58217
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
58209
58218
  var main = "dist/mage.js";
58210
58219
  var author$1 = {
@@ -58252,7 +58261,6 @@ var dependencies = {
58252
58261
  inferno: "7.3.2",
58253
58262
  "inferno-create-element": "7.3.3",
58254
58263
  "inferno-redux": "7.4.2",
58255
- "mage-engine.particles": "github:MageStudio/partykals#v2.0.5",
58256
58264
  redux: "4.0.5",
58257
58265
  "redux-thunk": "^2.3.0",
58258
58266
  rxjs: "6.5.3",
@@ -60463,6 +60471,16 @@ let CascadeShadowMaps = /*#__PURE__*/function () {
60463
60471
  value: function add(light) {
60464
60472
  this.lights.push(light);
60465
60473
  }
60474
+ }, {
60475
+ key: "dispose",
60476
+ value: function dispose() {
60477
+ this.lights = [];
60478
+
60479
+ if (this.csm) {
60480
+ this.csm.dispose();
60481
+ this.csm = undefined;
60482
+ }
60483
+ }
60466
60484
  }, {
60467
60485
  key: "update",
60468
60486
  value: function update(dt) {
@@ -66964,7 +66982,7 @@ function patchKeyedChildrenComplex$1(a, b, context, aLength, bLength, aEnd, bEnd
66964
66982
  }
66965
66983
  }
66966
66984
  var result$1;
66967
- var p$2;
66985
+ var p$1;
66968
66986
  var maxLen$1 = 0;
66969
66987
  // https://en.wikipedia.org/wiki/Longest_increasing_subsequence
66970
66988
  function lis_algorithm$1(arr) {
@@ -66979,14 +66997,14 @@ function lis_algorithm$1(arr) {
66979
66997
  if (len > maxLen$1) {
66980
66998
  maxLen$1 = len;
66981
66999
  result$1 = new Int32Array(len);
66982
- p$2 = new Int32Array(len);
67000
+ p$1 = new Int32Array(len);
66983
67001
  }
66984
67002
  for (; i < len; ++i) {
66985
67003
  arrI = arr[i];
66986
67004
  if (arrI !== 0) {
66987
67005
  j = result$1[k];
66988
67006
  if (arr[j] < arrI) {
66989
- p$2[i] = j;
67007
+ p$1[i] = j;
66990
67008
  result$1[++k] = i;
66991
67009
  continue;
66992
67010
  }
@@ -67003,7 +67021,7 @@ function lis_algorithm$1(arr) {
67003
67021
  }
67004
67022
  if (arrI < arr[result$1[u]]) {
67005
67023
  if (u > 0) {
67006
- p$2[i] = result$1[u - 1];
67024
+ p$1[i] = result$1[u - 1];
67007
67025
  }
67008
67026
  result$1[u] = i;
67009
67027
  }
@@ -67014,7 +67032,7 @@ function lis_algorithm$1(arr) {
67014
67032
  v = result$1[u - 1];
67015
67033
  while (u-- > 0) {
67016
67034
  seq[u] = v;
67017
- v = p$2[v];
67035
+ v = p$1[v];
67018
67036
  result$1[u] = 0;
67019
67037
  }
67020
67038
  return seq;
@@ -69688,7 +69706,7 @@ function patchKeyedChildrenComplex(a, b, context, aLength, bLength, aEnd, bEnd,
69688
69706
  }
69689
69707
  }
69690
69708
  var result;
69691
- var p$1;
69709
+ var p;
69692
69710
  var maxLen = 0;
69693
69711
  // https://en.wikipedia.org/wiki/Longest_increasing_subsequence
69694
69712
  function lis_algorithm(arr) {
@@ -69703,14 +69721,14 @@ function lis_algorithm(arr) {
69703
69721
  if (len > maxLen) {
69704
69722
  maxLen = len;
69705
69723
  result = new Int32Array(len);
69706
- p$1 = new Int32Array(len);
69724
+ p = new Int32Array(len);
69707
69725
  }
69708
69726
  for (; i < len; ++i) {
69709
69727
  arrI = arr[i];
69710
69728
  if (arrI !== 0) {
69711
69729
  j = result[k];
69712
69730
  if (arr[j] < arrI) {
69713
- p$1[i] = j;
69731
+ p[i] = j;
69714
69732
  result[++k] = i;
69715
69733
  continue;
69716
69734
  }
@@ -69727,7 +69745,7 @@ function lis_algorithm(arr) {
69727
69745
  }
69728
69746
  if (arrI < arr[result[u]]) {
69729
69747
  if (u > 0) {
69730
- p$1[i] = result[u - 1];
69748
+ p[i] = result[u - 1];
69731
69749
  }
69732
69750
  result[u] = i;
69733
69751
  }
@@ -69738,7 +69756,7 @@ function lis_algorithm(arr) {
69738
69756
  v = result[u - 1];
69739
69757
  while (u-- > 0) {
69740
69758
  seq[u] = v;
69741
- v = p$1[v];
69759
+ v = p[v];
69742
69760
  result[u] = 0;
69743
69761
  }
69744
69762
  return seq;
@@ -73252,10 +73270,10 @@ var rev = new u16(32768);
73252
73270
 
73253
73271
  for (var i = 0; i < 32768; ++i) {
73254
73272
  // reverse table algorithm from SO
73255
- var x$1 = (i & 0xAAAA) >>> 1 | (i & 0x5555) << 1;
73256
- x$1 = (x$1 & 0xCCCC) >>> 2 | (x$1 & 0x3333) << 2;
73257
- x$1 = (x$1 & 0xF0F0) >>> 4 | (x$1 & 0x0F0F) << 4;
73258
- rev[i] = ((x$1 & 0xFF00) >>> 8 | (x$1 & 0x00FF) << 8) >>> 1;
73273
+ var x = (i & 0xAAAA) >>> 1 | (i & 0x5555) << 1;
73274
+ x = (x & 0xCCCC) >>> 2 | (x & 0x3333) << 2;
73275
+ x = (x & 0xF0F0) >>> 4 | (x & 0x0F0F) << 4;
73276
+ rev[i] = ((x & 0xFF00) >>> 8 | (x & 0x00FF) << 8) >>> 1;
73259
73277
  } // create huffman tree from u8 "map": index -> code length for code index
73260
73278
  // mb (max bits) must be at most 15
73261
73279
  // TODO: optimize/split up?
@@ -84858,7 +84876,7 @@ var ZipBufferIterator = /*@__PURE__*/ (function (_super) {
84858
84876
  return subscribeToResult(this, this.observable, this, index);
84859
84877
  };
84860
84878
  return ZipBufferIterator;
84861
- }(OuterSubscriber));/** PURE_IMPORTS_START PURE_IMPORTS_END */var index$2=/*#__PURE__*/Object.freeze({__proto__:null,Observable:Observable,ConnectableObservable:ConnectableObservable,GroupedObservable:GroupedObservable,observable:observable,Subject:Subject,BehaviorSubject:BehaviorSubject,ReplaySubject:ReplaySubject,AsyncSubject:AsyncSubject,asapScheduler:asap,asyncScheduler:async,queueScheduler:queue,animationFrameScheduler:animationFrame,VirtualTimeScheduler:VirtualTimeScheduler,VirtualAction:VirtualAction,Scheduler:Scheduler,Subscription:Subscription,Subscriber:Subscriber,Notification:Notification,get NotificationKind(){return NotificationKind},pipe:pipe,noop:noop,identity:identity,isObservable:isObservable,ArgumentOutOfRangeError:ArgumentOutOfRangeError,EmptyError:EmptyError,ObjectUnsubscribedError:ObjectUnsubscribedError,UnsubscriptionError:UnsubscriptionError,TimeoutError:TimeoutError,bindCallback:bindCallback,bindNodeCallback:bindNodeCallback,combineLatest:combineLatest,concat:concat,defer:defer,empty:empty,forkJoin:forkJoin,from:from,fromEvent:fromEvent,fromEventPattern:fromEventPattern,generate:generate,iif:iif,interval:interval,merge:merge,never:never,of:of,onErrorResumeNext:onErrorResumeNext,pairs:pairs,partition:partition,race:race,range:range,throwError:throwError,timer:timer,using:using,zip:zip,scheduled:scheduled,EMPTY:EMPTY$1,NEVER:NEVER,config:config});const ONE_MB = 1048576;
84879
+ }(OuterSubscriber));/** PURE_IMPORTS_START PURE_IMPORTS_END */var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Observable:Observable,ConnectableObservable:ConnectableObservable,GroupedObservable:GroupedObservable,observable:observable,Subject:Subject,BehaviorSubject:BehaviorSubject,ReplaySubject:ReplaySubject,AsyncSubject:AsyncSubject,asapScheduler:asap,asyncScheduler:async,queueScheduler:queue,animationFrameScheduler:animationFrame,VirtualTimeScheduler:VirtualTimeScheduler,VirtualAction:VirtualAction,Scheduler:Scheduler,Subscription:Subscription,Subscriber:Subscriber,Notification:Notification,get NotificationKind(){return NotificationKind},pipe:pipe,noop:noop,identity:identity,isObservable:isObservable,ArgumentOutOfRangeError:ArgumentOutOfRangeError,EmptyError:EmptyError,ObjectUnsubscribedError:ObjectUnsubscribedError,UnsubscriptionError:UnsubscriptionError,TimeoutError:TimeoutError,bindCallback:bindCallback,bindNodeCallback:bindNodeCallback,combineLatest:combineLatest,concat:concat,defer:defer,empty:empty,forkJoin:forkJoin,from:from,fromEvent:fromEvent,fromEventPattern:fromEventPattern,generate:generate,iif:iif,interval:interval,merge:merge,never:never,of:of,onErrorResumeNext:onErrorResumeNext,pairs:pairs,partition:partition,race:race,range:range,throwError:throwError,timer:timer,using:using,zip:zip,scheduled:scheduled,EMPTY:EMPTY$1,NEVER:NEVER,config:config});const ONE_MB = 1048576;
84862
84880
 
84863
84881
  let Stats = /*#__PURE__*/function () {
84864
84882
  function Stats() {
@@ -87185,8 +87203,21 @@ let OutlineEffect = /*#__PURE__*/function () {
87185
87203
 
87186
87204
  return PostProcessing;
87187
87205
  }();
87188
- var PostProcessing$1 = new PostProcessing();function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n);}}function d(t,e,i){return e&&u(t.prototype,e),i&&u(t,i),t}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e);}function v(t){return (v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){return (y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function m(t,e){return !e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var g=function(t,e){return Math.random()*(e-t)+t},C=function(t,e){return e?g(t,t+e):t},S=function(e,i){return i?new Color$1(g(e.r,i.r),g(e.g,i.g),g(e.b,i.b)):e?e.clone():new Color$1},z=function(t,i){return i?new Vector3$1(g(t.x,i.x),g(t.y,i.y),g(t.z,i.z)):t?t.clone():new Vector3$1},w=function(t,e,i){return t.clone().lerp(e,i)},_=function(t,e,i){return t*(1-i)+e*i},A=function(t){return (t.generate?t.generate():t)||0},b=Object.freeze({__proto__:null,getRandomBetween:g,getRandomWithSpread:C,getRandomColorBetween:S,getRandomVectorBetween:z,lerpColors:w,lerp:_,randomizerOrValue:A}),P=function(){function t(e){p(this,t),this.system=e,this.reset();}return d(t,[{key:"reset",value:function(){var t=this.system.options.particles;this.age=0,this.finished=!1,this.gravity=t.gravity,this.velocity=x(t.velocity),t.velocityBonus&&this.velocity.add(t.velocityBonus),this.acceleration=x(t.acceleration,!0),this.position=x(t.offset||new Vector3$1),this.ttl=C(t.ttl||1,t.ttlExtra)||1,this.alpha=this.startAlpha=this.endAlpha=null,this.startAlphaChangeAt=(t.startAlphaChangeAt||0)/this.ttl,t.fade&&(void 0!==t.alpha?this.alpha=A(t.alpha):(this.startAlpha=A(t.startAlpha),this.endAlpha=A(t.endAlpha))),this.colorize=Boolean(t.colorize),this.color=this.startColor=this.endColor=null,this.startColorChangeAt=(t.startColorChangeAt||0)/this.ttl,this.colorize&&(t.color?this.color=T(t.color):(this.startColor=T(t.startColor),this.endColor=T(t.endColor))),this.size=this.startSize=this.endSize=null,this.startSizeChangeAt=(t.startSizeChangeAt||0)/this.ttl,t.scaling&&(void 0!==t.size?this.size=A(t.size):(this.startSize=A(t.startSize),this.endSize=A(t.endSize))),this.rotation=this.rotationSpeed=null,t.rotating&&(this.rotation=A(t.rotation||0),this.rotationSpeed=A(t.rotationSpeed||0)),this.startWorldPosition=null,this.onUpdate=t.onUpdate,t.onSpawn&&t.onSpawn(this);}},{key:"update",value:function(t,e){if(!this.finished){0===this.age?(this.system.options.particles.worldPosition&&(this.startWorldPosition=this.system.getWorldPosition()),null===this.alpha&&null===this.startAlpha||this.system.setAlpha(t,this.alpha||this.startAlpha),null===this.color&&null===this.startColor||this.system.setColor(t,this.color||this.startColor),null===this.size&&null===this.startSize||this.system.setSize(t,this.size||this.startSize),null!==this.rotation&&this.system.setRotation(t,this.rotation)):(this.startColor&&this.age>=this.startColorChangeAt&&this.system.setColor(t,w(this.startColor,this.endColor,this.startColorChangeAt?(this.age-this.startColorChangeAt)/(1-this.startColorChangeAt):this.age)),null!=this.startAlpha&&this.age>=this.startAlphaChangeAt&&this.system.setAlpha(t,_(this.startAlpha,this.endAlpha,this.startAlphaChangeAt?(this.age-this.startAlphaChangeAt)/(1-this.startAlphaChangeAt):this.age)),null!=this.startSize&&this.age>=this.startSizeChangeAt&&this.system.setSize(t,_(this.startSize,this.endSize,this.startSizeChangeAt?(this.age-this.startSizeChangeAt)/(1-this.startSizeChangeAt):this.age))),this.gravity&&this.velocity&&(this.velocity.y+=this.gravity*e),this.rotationSpeed&&(this.rotation+=this.rotationSpeed*e,this.system.setRotation(t,this.rotation)),this.velocity&&(this.position.x+=this.velocity.x*e,this.position.y+=this.velocity.y*e,this.position.z+=this.velocity.z*e);var i=this.position;if(this.startWorldPosition){var n=this.system.getWorldPosition();n.sub(this.startWorldPosition),i=i.clone().sub(n);}this.system.setPosition(t,i),this.acceleration&&this.velocity&&(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.velocity.z+=this.acceleration.z*e),this.age+=e/this.ttl,this.onUpdate&&this.onUpdate(this),this.age>1&&(this.age=1,this.finished=!0);}}},{key:"worldPosition",get:function(){return this.system.getWorldPosition().add(this.position)}}]),t}();function x(t,i){return t?t.generate?t.generate():t.clone():i?null:new Vector3$1}function T(e,i){return e?e.generate?e.generate():e.clone():i?null:new Color$1(1,1,1)}var R=function(){function e(r){p(this,e),this.options=r;var o={globalColor:{value:new Color$1(r.color||16777215)},rendererScale:{value:1}},s="";r.perspective&&(s+="#define PERSPECTIVE\n"),r.map&&(s+="#define TEXTURE\n",o.texture={value:r.map}),r.perParticleColor&&(s+="#define COLORING\n"),r.perParticleRotation&&(s+="#define ROTATION\n"),r.constSize&&(s+="#define CONST_SIZE\n",o.constSize={value:r.constSize}),r.alphaTest&&(s+="#define ALPHA_TEST\n"),s+="\n",this.material=new ShaderMaterial({uniforms:o,vertexShader:s+"\n// attributes we get from geometry\nattribute float alpha;\n\n// per-particle size\n#ifdef CONST_SIZE\n uniform float constSize;\n#else\n attribute float size;\n#endif\n\n// per-particle rotation\n#ifdef ROTATION\n attribute float rotation;\n#endif\n\n// system scale when using perspective mode\n#ifdef PERSPECTIVE\n uniform float rendererScale;\n#endif\n\n// output params for fragment shader\nvarying float vAlpha;\n\n// set per-particle color\n#ifdef COLORING\n varying vec3 vColor;\n#endif\n\n// get per-particle rotation\n#ifdef ROTATION\n varying float vRotation;\n#endif\n\n// vertex shader main\nvoid main() \n{\n // alpha and color\n vAlpha = alpha;\n\n // set color\n #ifdef COLORING\n vColor = color;\n #endif\n\n // set const size\n #ifdef CONST_SIZE\n float size = constSize;\n #endif\n\n // set position\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n\n // apply rotation\n #ifdef ROTATION\n vRotation = rotation;\n #endif\n \n // set size - either perspective or constant\n #ifdef PERSPECTIVE\n gl_PointSize = size * (rendererScale / length(mvPosition.xyz));\n #else\n gl_PointSize = size;\n #endif\n}\n",fragmentShader:s+"\n// material uniforms\nuniform vec3 globalColor;\n\n// params we get from vertex shader\nvarying float vAlpha;\n\n// per-particle color from vertex shader\n#ifdef COLORING\n varying vec3 vColor;\n#endif\n\n// per-particle rotation from vertex shader\n#ifdef ROTATION\n varying float vRotation;\n#endif\n\n// diffuse texture\n#ifdef TEXTURE\n uniform sampler2D texture;\n#endif\n\n// fragment shader main\nvoid main() \n{\n // set default color if don't have per-particle colors\n #ifndef COLORING\n vec3 vColor = vec3(1,1,1);\n #endif\n\n // texture\n #ifdef TEXTURE\n\n // use rotation (rotate texture)\n #ifdef ROTATION\n float mid = 0.5;\n vec2 rotated = vec2(cos(vRotation) * (gl_PointCoord.x - mid) + sin(vRotation) * (gl_PointCoord.y - mid) + mid,\n cos(vRotation) * (gl_PointCoord.y - mid) - sin(vRotation) * (gl_PointCoord.x - mid) + mid);\n vec4 texture = texture2D(texture, rotated);\n // no rotation\n #else\n vec2 coords = vec2((gl_PointCoord.x - 0.5) + 0.5, (gl_PointCoord.y - 0.5) + 0.5);\n vec4 texture = texture2D(texture, coords);\n #endif\n\n // get color with texture\n gl_FragColor = vec4( globalColor * vColor, vAlpha ) * texture;\n \n // no texture (colors only)\n #else\n gl_FragColor = vec4( globalColor * vColor, vAlpha );\n #endif\n\n // check if need to discard pixel\n #ifdef ALPHA_TEST\n if (gl_FragColor.a < 0.00001) { discard; }\n #endif\n}\n",transparent:Boolean(r.transparent),blending:r.blending,vertexColors:VertexColors,depthWrite:Boolean(r.depthWrite),depthTest:Boolean(r.depthTest)});}return d(e,[{key:"dispose",value:function(){this.material.dispose();}},{key:"setBaseScale",value:function(t){this.options.perspective&&(this.material.uniforms.rendererScale.value=t);}}]),e}(),O=function(t){return null!=t},E=function(){function i(e){p(this,i),e.particles=e.particles||{worldPosition:!0},e.system=e.system||{},this.options=e,this.hasStarted=!1;var n=e.particles;if("number"==typeof e.particles.size&&(console.warn("Note: replaced 'size' with 'globalSize' property since its more efficient and provided size value was constant anyway."),e.particles.globalSize=e.particles.size,delete e.particles.size),e.particles.color instanceof Color$1&&(console.warn("Note: replaced 'color' with 'globalColor' property since its more efficient and you provided color value was constant anyway."),e.particles.globalColor=e.particles.color,delete e.particles.color),e.particles.fade=O(n.startAlpha)||O(n.alpha),e.particles.rotating=O(n.rotationSpeed)||O(n.rotation),e.particles.colorize=O(n.color)||O(n.startColor),e.particles.scaling=O(n.size)||O(n.startSize),O(n.startAlpha)&&!O(n.endAlpha))throw new Error("When providing 'startAlpha' you must also provide 'endAlpha'!");if(O(n.startAlpha)&&O(n.alpha))throw new Error("When providing 'alpha' you can't also provide 'startAlpha'!");if(O(n.startColor)&&!O(n.endColor))throw new Error("When providing 'startColor' you must also provide 'endColor'!");if(O(n.startColor)&&O(n.color))throw new Error("When providing 'color' you can't also provide 'startColor'!");if(O(n.startSize)&&!O(n.endSize))throw new Error("When providing 'startSize' you must also provide 'endSize'!");if(O(n.startSize)&&O(n.size))throw new Error("When providing 'size' you can't also provide 'startSize'!");this.particleCount=e.system.particlesCount||10,this.blending=e.particles.blending||"opaque",this.threeBlend={opaque:NoBlending,additive:AdditiveBlending,multiply:MultiplyBlending,blend:NormalBlending}[this.blending],this.create(),e.autostart&&this.start();}return d(i,[{key:"create",value:function(){this._emitters=[];var t=this.options,e=t.system,i=t.particles;t.container;if(e.emitters)if(e.emitters instanceof Array)for(var n=0;n<e.emitters.length;++n)this.addEmitter(e.emitters[n]);else this.addEmitter(e.emitters);var r="opaque"!==this.blending;this.particlesGeometry=new BufferGeometry;var o=void 0===e.perspective||Boolean(e.perspective),s=new R({size:i.size||10,color:i.globalColor||16777215,blending:this.threeBlend,perspective:o,transparent:r,map:i.texture,perParticleColor:Boolean(i.colorize),alphaTest:"blend"===this.blending&&O(i.texture),constSize:O(i.globalSize)?i.globalSize:null,depthWrite:!O(e.depthWrite)||e.depthWrite,depthTest:!O(e.depthTest)||e.depthTest,perParticleRotation:i.rotating});this.material=s,this.speed=e.speed||1,this.reset(),this._aliveParticles=[],this._deadParticles=[];for(var a=new Float32Array(3*this.particleCount),p=i.colorize?new Float32Array(3*this.particleCount):null,u=i.fade?new Float32Array(1*this.particleCount):null,d=i.scaling?new Float32Array(1*this.particleCount):null,f=i.rotating?new Float32Array(1*this.particleCount):null,v=0;v<this.particleCount;v++){var y=3*v;a[y]=a[y+1]=a[y+2]=0,p&&(p[y]=p[y+1]=p[y+2]=1),u&&(u[v]=1),d&&(d[v]=1),f&&(f[v]=0),this._deadParticles.push(new P(this));}this.particlesGeometry.setAttribute("position",new BufferAttribute(a,3)),u&&this.particlesGeometry.setAttribute("alpha",new BufferAttribute(u,1)),p&&this.particlesGeometry.setAttribute("color",new BufferAttribute(p,3)),d&&this.particlesGeometry.setAttribute("size",new BufferAttribute(d,1)),f&&this.particlesGeometry.setAttribute("rotation",new BufferAttribute(f,1)),this.particlesGeometry.setDrawRange(0,0),this.material.setBaseScale(e.scale||400);var m=new Points(this.particlesGeometry,this.material.material);m.sortParticles=r,this.particleSystem=m,this._positionDirty=!0,this._colorsDirty=Boolean(p),this._alphaDirty=Boolean(u),this._rotateDirty=Boolean(f);}},{key:"start",value:function(){var t=this.options.container;t?(this.addTo(t),this.hasStarted=!0):console.log("no container for particle system, aborting.");}},{key:"stop",value:function(){this.ttl=0;}},{key:"addEmitter",value:function(t){this._emitters.push(t);}},{key:"dispose",value:function(){this.particlesGeometry.dispose(),this.material.dispose();}},{key:"reset",value:function(){this.ttl=this.options.system.ttl,this.age=0,this._timeToUpdateBS=0;}},{key:"getWorldPosition",value:function(){var t=new Vector3$1;return this.particleSystem.getWorldPosition(t),t}},{key:"addTo",value:function(t){t.add(this.particleSystem);}},{key:"setColor",value:function(t,e){t*=3;var i=this.particlesGeometry.attributes.color.array;i[t]=e.r,i[t+1]=e.g,i[t+2]=e.b,this._colorsDirty=!0;}},{key:"setPosition",value:function(t,e){t*=3;var i=this.particlesGeometry.attributes.position.array;i[t]=e.x,i[t+1]=e.y,i[t+2]=e.z,this._positionDirty=!0;}},{key:"setAlpha",value:function(t,e){this.particlesGeometry.attributes.alpha.array[t]=e,this._alphaDirty=!0;}},{key:"setRotation",value:function(t,e){this.particlesGeometry.attributes.rotation.array[t]=e,this._rotateDirty=!0;}},{key:"setSize",value:function(t,e){this.particlesGeometry.attributes.size.array[t]=e,this._sizeDirty=!0;}},{key:"removeAndDisposeIfFinished",value:function(){return !!this.finished&&(this.removeSelf(),this.dispose(),!0)}},{key:"update",value:function(t){if(this.hasStarted){if(void 0===t){var e=(new Date).getTime()/1e3;t=e-this._lastTime||0,this._lastTime=e;}if(0!==t){void 0!==this.ttl&&this.ttl>0&&(this.ttl-=t),t*=this.speed,this.dt=t,this.age+=t;var i=this._aliveParticles.length;if(!this.ttlExpired)for(var n=0;n<this._emitters.length;++n){var r=this._emitters[n].update(t,this);r&&this.spawnParticles(r);}for(n=this._aliveParticles.length-1;n>=0;--n){var o=this._aliveParticles[n];o.update(n,t),o.finished&&(this._aliveParticles.splice(n,1),this._deadParticles.push(o));}i!==this._aliveParticles.length&&this.particlesGeometry.setDrawRange(0,this._aliveParticles.length),this.particlesGeometry.attributes.position.needsUpdate=this._positionDirty,this._needBoundingSphereUpdate=this._needBoundingSphereUpdate||this._positionDirty,this._positionDirty=!1,this._colorsDirty&&(this.particlesGeometry.attributes.color.needsUpdate=!0,this._colorsDirty=!1),this._alphaDirty&&(this.particlesGeometry.attributes.alpha.needsUpdate=!0,this._alphaDirty=!1),this._sizeDirty&&(this.particlesGeometry.attributes.size.needsUpdate=!0,this._sizeDirty=!1),this._rotateDirty&&(this.particlesGeometry.attributes.rotation.needsUpdate=!0,this._rotateDirty=!1),this._needBoundingSphereUpdate&&(this._timeToUpdateBS-=t,this._timeToUpdateBS<=0&&(this._timeToUpdateBS=.2,this.particlesGeometry.computeBoundingSphere())),this.finished||this.options.system.onUpdate&&this.options.system.onUpdate(this);}}}},{key:"spawnParticles",value:function(t){for(var e=0;e<t;++e){if(0===this._deadParticles.length)return;var i=this._deadParticles.pop();i.reset(),this._aliveParticles.push(i);}}},{key:"removeSelf",value:function(){this.particleSystem.parent&&this.particleSystem.parent.remove(this.particleSystem);}},{key:"finished",get:function(){return this.ttlExpired&&0===this.particlesCount}},{key:"ttlExpired",get:function(){return void 0!==this.ttl&&this.ttl<=0}},{key:"particlesCount",get:function(){return this._aliveParticles.length}},{key:"maxParticlesCount",get:function(){return this._aliveParticles.length+this._deadParticles.length}}]),i}(),k=function(){function t(e){p(this,t),this.options=e,e.interval=e.interval||1,this.age=0,this.timeToSpawn=Math.random()*A(e.interval);}return d(t,[{key:"update",value:function(t,e){var i=0;if(0===this.age&&this.options.onSpawnBurst&&(i+=A(this.options.onSpawnBurst)),this.age+=t,!this.options.onInterval)return i;(this.timeToSpawn-=t,this.timeToSpawn<=0&&(this.timeToSpawn=A(this.options.interval),i+=A(this.options.onInterval)),this.options.detoretingMinTtl&&e.ttl<this.options.detoretingMinTtl)&&(i*=e.ttl/this.options.detoretingMinTtl);return i}}]),t}(),B=function(){function t(){p(this,t);}return d(t,[{key:"generate",value:function(){throw new Error("Not implemented.")}}]),t}(),D=function(t){function i(t,n){var r;return p(this,i),(r=m(this,v(i).call(this))).min=t||new Vector3$1(-1,-1,-1),r.max=n||new Vector3$1(1,1,1),r}return f(i,B),d(i,[{key:"generate",value:function(){return z(this.min,this.max)}}]),i}();function G(){return 2*Math.random()-1}var U=function(t){function i(t,e,n,r,o){var s;return p(this,i),(s=m(this,v(i).call(this))).maxRadius=t||1,s.minRadius=e||0,s.scaler=n,s.minVector=r,s.maxVector=o,s}return f(i,B),d(i,[{key:"generate",value:function(){var t=new Vector3$1(G(),G(),G());return (this.minVector||this.maxVector)&&t.clamp(this.minVector||new Vector3$1(-1,-1,-1),this.maxVector||new Vector3$1(1,1,1)),t.normalize().multiplyScalar(g(this.minRadius,this.maxRadius)),this.scaler&&t.multiply(this.scaler),t}}]),i}(),W=function(e){function i(e,n){var r;return p(this,i),(r=m(this,v(i).call(this))).min=e||new Color$1(0,0,0),r.max=n||new Color$1(1,1,1),r}return f(i,B),d(i,[{key:"generate",value:function(){return S(this.min,this.max)}}]),i}(),I=function(t){function e(t,i){var n;return p(this,e),(n=m(this,v(e).call(this))).min=t,n.max=i,n}return f(e,B),d(e,[{key:"generate",value:function(){return g(this.min,this.max)}}]),e}(),N=Object.freeze({__proto__:null,Randomizer:B,BoxRandomizer:D,SphereRandomizer:U,ColorsRandomizer:W,MinMaxRandomizer:I});
87189
- var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,ParticlesSystem:E,Randomizers:N,Utils:b});const PARTICLE_EMITTER_TYPES = {
87206
+ var PostProcessing$1 = new PostProcessing();var three_proton_min = {exports: {}};var require$$0 = /*@__PURE__*/getAugmentedNamespace(three_module);/*!
87207
+ * three.proton v0.2.0
87208
+ * https://github.com/drawcall/three.proton
87209
+ *
87210
+ * Copyright 2011-2020, ajiemath
87211
+ * Licensed under the MIT license
87212
+ * http://www.opensource.org/licenses/mit-license
87213
+ *
87214
+ */
87215
+
87216
+ (function (module, exports) {
87217
+ (function(a,b){module.exports=b(require$$0);})(commonjsGlobal,function(a){function bd(a,b,c,d){bd._super_.call(this),this.camera=a,this.renderer=b,this.dis=c||20,d=d||"1234";for(var e=1;e<5;e++)this["d"+e]=d.indexOf(e+"")>=0;this.name="ScreenZone";}function bc(a,c,d,e,f,g){var h,i,j,k,l,e;bc._super_.call(this),b.Util.isUndefined(c,d,e,f,g)?(h=i=j=0,k=l=e=a||100):b.Util.isUndefined(e,f,g)?(h=i=j=0,k=a,l=c,e=d):(h=a,i=c,j=d,k=e,l=f,e=g),this.x=h,this.y=i,this.z=j,this.width=k,this.height=l,this.depth=e,this.friction=.85,this.max=6;}function bb(a,c,d){var e,f,g;bb._super_.call(this),b.Util.isUndefined(a,c,d)?e=f=g=0:(e=a,f=c,g=d),this.x=e,this.y=f,this.z=g;}function ba(b,c){ba._super_.call(this),b instanceof a.Geometry?this.geometry=b:this.geometry=b.geometry,this.scale=c||1;}function _(a,c,d,e){var f,i;_._super_.call(this),b.Util.isUndefined(c,d,e)?(f=0,i=a||100):(f=a,i=e),this.x=f,this.y=f,this.z=f,this.radius=i,this.tha=this.phi=0;}function $(a,c,d,e,f,g){$._super_.call(this),a instanceof b.Vector3D?(this.x1=a.x,this.y1=a.y,this.z1=a.z,this.x2=e.x,this.y2=e.y,this.z2=e.z):(this.x1=a,this.y1=c,this.z1=d,this.x2=e,this.y2=f,this.z2=g);}function Z(){this.vector=new b.Vector3D(0,0,0),this.random=0,this.crossType="dead",this.log=!0;}function Y(){Y._super_.call(this),this.targetPool=new b.Pool,this.materialPool=new b.Pool,this.name="CustomRender";}function X(b){X._super_.call(this,b),this._body=new a.Sprite(new a.SpriteMaterial({color:16777215})),this.name="SpriteRender";}function W(a){W._super_.call(this),this.points=a,this.name="PointsRender";}function V(c){V._super_.call(this),this.container=c,this._targetPool=new b.Pool,this._materialPool=new b.Pool,this._body=new a.Mesh(new a.BoxGeometry(50,50,50),new a.MeshLambertMaterial({color:"#ff0000"})),this.name="MeshRender";}function U(){this.name="BaseRender";}function R(a,c,d){this.mouseTarget=b.Util.initValue(a,window),this.ease=b.Util.initValue(c,.7),this._allowEmitting=!1,this.mouse=new b.Vector3D,this.initEventHandler(),R._super_.call(this,d);}function Q(a){this.selfBehaviours=[],Q._super_.call(this,a);}function P(a){this.initializes=[],this.particles=[],this.behaviours=[],this.currentEmitTime=0,this.totalEmitTimes=-1,this.damping=.006,this.bindEmitter=!0,this.rate=new b.Rate(1,.1),P._super_.call(this,a),this.id="emitter_"+P.ID++,this.cID=0,this.name="Emitter";}function O(a,b,c,d,e,f,g){O._super_.call(this,f,g),O.prototype.reset(a,b,c,d,e),this.name="Spring";}function N(a,b,c,d){N._super_.call(this,c,d),this.reset(a,b),this.name="Color";}function M(a,b,c,d,e){M._super_.call(this,d,e),this.reset(a,b,c),this.name="Rotate";}function L(a,b,c,d){L._super_.call(this,c,d),this.reset(a,b),this.name="Scale";}function K(a,b,c,d){K._super_.call(this,c,d),this.reset(a,b),this.name="Alpha";}function J(a,b,c,d){J._super_.call(this,c,d),this.reset(a,b),this.name="CrossZone";}function I(a,b,c,d,e){I._super_.call(this,d,e),this.reset(a,b,c),this.name="Collision";}function H(a,b,c){H._super_.call(this,0,-a,0,b,c),this.name="Gravity";}function G(a,b,c,d,e){G._super_.call(this,a,b,c,d,e),this.force*=-1,this.name="Repulsion";}function F(a,b,c,d,e,f){F._super_.call(this,e,f),this.reset(a,b,c,d),this.time=0,this.name="RandomDrift";}function E(a,c,d,e,f){E._super_.call(this,e,f),this.targetPosition=b.Util.initValue(a,new b.Vector3D),this.radius=b.Util.initValue(d,1e3),this.force=b.Util.initValue(this.normalizeValue(c),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new b.Vector3D,this.lengthSq=0,this.name="Attraction";}function D(a,b,c,d,e){D._super_.call(this,d,e),D.prototype.reset.call(this,a,b,c),this.name="Force";}function C(a,c,d){C._super_.call(this),this.body=b.createArraySpan(a),this.w=c,this.h=b.Util.initValue(d,this.w);}function B(a,c,d){B._super_.call(this),this.radius=b.createSpan(a,c,d);}function A(a,c,d){A._super_.call(this),this.massPan=b.createSpan(a,c,d);}function z(a,c,d){z._super_.call(this),this.reset(a,c,d),this.dirVec=new b.Vector3D(0,0,0),this.name="Velocity";}function y(){y._super_.call(this),this.reset.apply(this,arguments);}function x(a,c,d){x._super_.call(this),this.lifePan=b.createSpan(a,c,d);}function v(){this.name="Initialize";}function u(a,c){this.numPan=b.createSpan(b.Util.initValue(a,1)),this.timePan=b.createSpan(b.Util.initValue(c,1)),this.startTime=0,this.nextTime=0,this.init();}function t(a,c){this.id="Behaviour_"+t.id++,this.life=b.Util.initValue(a,Infinity),this.easing=b.Util.initValue(c,b.ease.setEasingByName(b.ease.easeLinear)),this.age=0,this.energy=1,this.dead=!1,this.name="Behaviour";}function s(a,b,c,d,e,f){this.x=a,this.y=b,this.z=c,this.width=d,this.height=e,this.depth=f,this.bottom=this.y+this.height,this.right=this.x+this.width,this.right=this.x+this.width;}function q(a){this._arr=b.Util.isArray(a)?a:[a];}function p(a,c,d){this._isArray=!1,b.Util.isArray(a)?(this._isArray=!0,this.a=a):(this.a=b.Util.initValue(a,1),this.b=b.Util.initValue(c,this.a),this._center=b.Util.initValue(d,!1));}function j(){this.cID=0,this.list={};}function i(a){this.id="particle_"+i.ID++,this.name="Particle",this.reset("init"),b.Util.setPrototypeByObj(this,a);}function c(){this.initialize();}function b(a,c){this.preParticles=b.Util.initValue(a,b.POOL_MAX),this.integrationType=b.Util.initValue(c,b.EULER),this.emitters=[],this.renderers=[],this.pool=new b.Pool,b.integrator=new b.Integration(this.integrationType);}b.POOL_MAX=500,b.TIME_STEP=60,b.PI=3.142,b.DR=b.PI/180,b.MEASURE=100,b.EULER="euler",b.RK2="runge-kutta2",b.RK4="runge-kutta4",b.VERLET="verlet",b.PARTICLE_CREATED="partilcleCreated",b.PARTICLE_UPDATE="partilcleUpdate",b.PARTICLE_SLEEP="particleSleep",b.PARTICLE_DEAD="partilcleDead",b.PROTON_UPDATE="protonUpdate",b.PROTON_UPDATE_AFTER="protonUpdateAfter",b.EMITTER_ADDED="emitterAdded",b.EMITTER_REMOVED="emitterRemoved",b.bindEmtterEvent=!1,b.prototype={addRender:function(a){this.renderers.push(a),a.init(this);},removeRender:function(a){this.renderers.splice(this.renderers.indexOf(a),1),a.remove(this);},addEmitter:function(a){this.emitters.push(a),a.parent=this,this.dispatchEvent("EMITTER_ADDED",a);},removeEmitter:function(a){a.parent==this&&(this.emitters.splice(this.emitters.indexOf(a),1),a.parent=null,this.dispatchEvent("EMITTER_REMOVED",a));},update:function(a){this.dispatchEvent("PROTON_UPDATE",this);var b=a||.0167;if(b>0){var c=this.emitters.length;while(c--)this.emitters[c].update(b);}this.dispatchEvent("PROTON_UPDATE_AFTER",this);},getCount:function(){var a=0,b,c=this.emitters.length;for(b=0;b<c;b++)a+=this.emitters[b].particles.length;return a},destroy:function(){var a=0,b=this.emitters.length;for(a;a<b;a++)this.emitters[a].destroy(),delete this.emitters[a];this.emitters.length=0,this.pool.destroy();}},c.initialize=function(a){a.addEventListener=d.addEventListener,a.removeEventListener=d.removeEventListener,a.removeAllEventListeners=d.removeAllEventListeners,a.hasEventListener=d.hasEventListener,a.dispatchEvent=d.dispatchEvent;};var d=c.prototype;d._listeners=null,d.initialize=function(){},d.addEventListener=function(a,b){this._listeners?this.removeEventListener(a,b):this._listeners={},this._listeners[a]||(this._listeners[a]=[]),this._listeners[a].push(b);return b},d.removeEventListener=function(a,b){if(!!this._listeners){if(!this._listeners[a])return;var c=this._listeners[a];for(var d=0,e=c.length;d<e;d++)if(c[d]==b){e==1?delete this._listeners[a]:c.splice(d,1);break}}},d.removeAllEventListeners=function(a){a?this._listeners&&delete this._listeners[a]:this._listeners=null;},d.dispatchEvent=function(a,b){var c=!1,d=this._listeners;if(a&&d){var e=d[a];if(!e)return c;e=e.slice();var f,g=e.length;while(g--){var f=e[g];c=c||f(b);}}return !!c},d.hasEventListener=function(a){var b=this._listeners;return !!b&&!!b[a]},c.initialize(b.prototype),b.EventDispatcher=c;var e=e||{initValue:function(a,b){var a=a!=null&&a!=undefined?a:b;return a},isArray:function(a){return Object.prototype.toString.call(a)==="[object Array]"},destroyArray:function(a){a.length=0;},destroyObject:function(a){for(var b in a)delete a[b];},isUndefined:function(){for(var a in arguments){var b=arguments[a];if(b!==undefined)return !1}return !0},setVectorByObj:function(a,b){b.x!==undefined&&(a.p.x=b.x),b.y!==undefined&&(a.p.y=b.y),b.z!==undefined&&(a.p.z=b.z),b.vx!==undefined&&(a.v.x=b.vx),b.vy!==undefined&&(a.v.y=b.vy),b.vz!==undefined&&(a.v.z=b.vz),b.ax!==undefined&&(a.a.x=b.ax),b.ay!==undefined&&(a.a.y=b.ay),b.az!==undefined&&(a.a.z=b.az),b.p!==undefined&&a.p.copy(b.p),b.v!==undefined&&a.v.copy(b.v),b.a!==undefined&&a.a.copy(b.a),b.position!==undefined&&a.p.copy(b.position),b.velocity!==undefined&&a.v.copy(b.velocity),b.accelerate!==undefined&&a.a.copy(b.accelerate);},setPrototypeByObj:function(a,b,c){for(var d in b)a.hasOwnProperty(d)&&(c?c.indexOf(d)<0&&(a[d]=e._getValue(b[d])):a[d]=e._getValue(b[d]));return a},_getValue:function(a){return a instanceof p?a.getValue():a},inherits:function(a,b){a._super_=b;if(Object.create)a.prototype=Object.create(b.prototype,{constructor:{value:a}});else {var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a;}}};b.Util=e;var f=f||{getRGB:function(b){var c={};if(typeof b=="number")e=Math.floor(b),c.r=(b>>16&255)/255,c.g=(b>>8&255)/255,c.b=(b&255)/255;else if(typeof b=="string"){var d;if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(b))c.r=Math.min(255,parseInt(d[1],10))/255,c.g=Math.min(255,parseInt(d[2],10))/255,c.b=Math.min(255,parseInt(d[3],10))/255;else if(d=/^\#([A-Fa-f0-9]+)$/.exec(b)){var e=d[1];c.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,c.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,c.b=parseInt(e.charAt(4)+e.charAt(5),16)/255;}}else b instanceof a.Color&&(c.r=b.r,c.g=b.g,c.b=b.b);return c}};b.ColorUtil=f;var g={toScreenPos:function(){var b=new a.Vector3;return function(a,c,d){b.copy(a),b.project(c),b.x=Math.round((b.x+1)*d.width/2),b.y=Math.round((-b.y+1)*d.height/2),b.z=0;return b}}(),toSpacePos:function(){var b=new a.Vector3,c=new a.Vector3,d;return function(a,e,f){b.set(a.x/f.width*2-1,-(a.y/f.height)*2+1,.5),b.unproject(e),c.copy(b.sub(e.position).normalize()),d=-e.position.z/c.z,b.copy(e.position),b.add(c.multiplyScalar(d));return b}}(),getTexture:function(){var c={};return function(d){if(d instanceof a.Texture)return d;if(typeof d=="string"){var e=b.PUID.hash(d);c[e]||(c[e]=new a.Texture(d));return c[e]}if(d instanceof Image){var e=b.PUID.hash(d.src);c[e]||(c[e]=new a.Texture(d));return c[e]}}}()};b.THREEUtil=g;var h=h||{_id:0,_uids:{},id:function(a){for(var b in this._uids)if(this._uids[b]==a)return b;var c="PUID_"+this._id++;this._uids[c]=a;return c},hash:function(a){return}};b.PUID=h,i.ID=0,i.prototype={getDirection:function(){return Math.atan2(this.v.x,-this.v.y)*(180/b.PI)},reset:function(a){this.life=Infinity,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=b.ease.setEasingByName(b.ease.easeLinear),a?(this.p=new b.Vector3D,this.v=new b.Vector3D,this.a=new b.Vector3D,this.old={},this.old.p=this.p.clone(),this.old.v=this.v.clone(),this.old.a=this.a.clone(),this.behaviours=[],this.transform={},this.color={r:0,g:0,b:0},this.rotation=new b.Vector3D):(this.p.set(0,0,0),this.v.set(0,0,0),this.a.set(0,0,0),this.old.p.set(0,0,0),this.old.v.set(0,0,0),this.old.a.set(0,0,0),this.color.r=0,this.color.g=0,this.color.b=0,this.rotation.clear(),b.Util.destroyObject(this.transform),this.removeAllBehaviours());return this},update:function(a,b){if(!this.sleep){this.age+=a;var c=this.behaviours.length;while(c--)this.behaviours[c]&&this.behaviours[c].applyBehaviour(this,a,b);}if(this.age>=this.life)this.destroy();else {var d=this.easing(this.age/this.life);this.energy=Math.max(1-d,0);}},addBehaviour:function(a){this.behaviours.push(a),a.initialize(this);},addBehaviours:function(a){var b=a.length;while(b--)this.addBehaviour(a[b]);},removeBehaviour:function(a){var b=this.behaviours.indexOf(a);b>-1&&this.behaviours.splice(b,1);},removeAllBehaviours:function(){b.Util.destroyArray(this.behaviours);},destroy:function(){this.removeAllBehaviours(),this.energy=0,this.dead=!0,this.parent=null;}},b.Particle=i,j.prototype={create:function(a){this.cID++;return typeof a=="function"?new a:a.clone()},getCount:function(){var a=0;for(var b in this.list)a+=this.list[b].length;return a++},get:function(a){var c,d=a.__puid||b.PUID.id(a);this.list[d]&&this.list[d].length>0?c=this.list[d].pop():c=this.create(a),c.__puid=a.__puid||d;return c},expire:function(a){return this._getList(a.__puid).push(a)},destroy:function(){for(var a in this.list)this.list[a].length=0,delete this.list[a];},_getList:function(a){a=a||"default",this.list[a]||(this.list[a]=[]);return this.list[a]}},b.Pool=j;var k={randomAToB:function(a,b,c){return c?(Math.random()*(b-a)>>0)+a:a+Math.random()*(b-a)},randomFloating:function(a,b,c){return k.randomAToB(a-b,a+b,c)},randomZone:function(a){},degreeTransform:function(a){return a*b.PI/180},toColor16:function(a){return "#"+a.toString(16)},randomColor:function(){return "#"+("00000"+(Math.random()*16777216<<0).toString(16)).slice(-6)},lerp:function(a,b,c){return b+(a-b)*c},getNormal:function(a,b){a.x==0&&a.y==0?a.z==0?b.set(1,0,1):b.set(1,1,-a.y/a.z):a.x==0?b.set(1,0,1):b.set(-a.y/a.x,1,1);return b.normalize()},axisRotate:function(a,b,c,d){var e=Math.cos(d),f=Math.sin(d),g=c.dot(b)*(1-e);a.copy(c),a.cross(b).scalar(f),a.addValue(b.x*e,b.y*e,b.z*e),a.addValue(c.x*g,c.y*g,c.z*g);}};b.MathUtils=k;var m=function(a){this.type=b.Util.initValue(a,b.EULER);};m.prototype={integrate:function(a,b,c){this.euler(a,b,c);},euler:function(a,b,c){a.sleep||(a.old.p.copy(a.p),a.old.v.copy(a.v),a.a.scalar(1/a.mass),a.v.add(a.a.scalar(b)),a.p.add(a.old.v.scalar(b)),c&&a.v.scalar(c),a.a.clear());}},b.Integration=m;var n=function(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0;};n.prototype={set:function(a,b,c){this.x=a,this.y=b,this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},getGradient:function(){if(this.x!=0)return Math.atan2(this.y,this.x);if(this.y>0)return b.PI/2;if(this.y<0)return -b.PI/2},copy:function(a){this.x=a.x,this.y=a.y,this.z=a.z;return this},add:function(a,b){if(b!==undefined)return this.addVectors(a,b);this.x+=a.x,this.y+=a.y,this.z+=a.z;return this},addValue:function(a,b,c){this.x+=a,this.y+=b,this.z+=c;return this},addVectors:function(a,b){this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z;return this},addScalar:function(a){this.x+=a,this.y+=a,this.z+=a;return this},sub:function(a,b){if(b!==undefined)return this.subVectors(a,b);this.x-=a.x,this.y-=a.y,this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z;return this},scalar:function(a){this.x*=a,this.y*=a,this.z*=a;return this},divideScalar:function(a){a!==0?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.scalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},cross:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y,this.y=d*a.x-b*a.z,this.z=b*a.y-c*a.x;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f;return this},eulerFromDir:function(a){},applyEuler:function(){var a;return function(c){a===undefined&&(a=new b.Quaternion),this.applyQuaternion(a.setFromEuler(c));return this}}(),applyAxisAngle:function(){var a;return function(c,d){a===undefined&&(a=new b.Quaternion),this.applyQuaternion(a.setFromAxisAngle(c,d));return this}}(),applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,h=a.w,i=h*b+f*d-g*c,j=h*c+g*b-e*d,k=h*d+e*c-f*b,l=-e*b-f*c-g*d;this.x=i*h+l*-e+j*-g-k*-f,this.y=j*h+l*-f+k*-e-i*-g,this.z=k*h+l*-g+i*-f-j*-e;return this},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,d=this.z-a.z;return b*b+c*c+d*d},lerp:function(a,b){this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},clear:function(){this.x=0,this.y=0,this.z=0;return this},clone:function(){return new b.Vector3D(this.x,this.y,this.z)},toString:function(){return "x:"+this.x+"y:"+this.y+"z:"+this.z}},b.Vector3D=n;var o=function(a,b,c){this.radius=a||1,this.phi=c||0,this.theta=b||0;};o.prototype={set:function(a,b,c){this.radius=a||1,this.phi=c||0,this.theta=b||0;return this},setRadius:function(a){this.radius=a;return this},setPhi:function(a){this.phi=a;return this},setTheta:function(a){this.theta=a;return this},copy:function(a){this.radius=a.radius,this.phi=a.phi,this.theta=a.theta;return this},toVector3D:function(){return new b.Vector3D(this.getX(),this.getY(),this.getZ())},getX:function(){return this.radius*Math.sin(this.theta)*Math.cos(this.phi)},getY:function(){return -this.radius*Math.sin(this.theta)*Math.sin(this.phi)},getZ:function(){return this.radius*Math.cos(this.theta)},normalize:function(){this.radius=1;return this},equals:function(a){return a.radius===this.radius&&a.phi===this.phi&&a.theta===this.theta},clear:function(){this.radius=0,this.phi=0,this.theta=0;return this},clone:function(){return new o(this.radius,this.phi,this.theta)}},b.Polar3D=o,p.prototype={getValue:function(a){return this._isArray?this.a[this.a.length*Math.random()>>0]:this._center?b.MathUtils.randomFloating(this.a,this.b,a):b.MathUtils.randomAToB(this.a,this.b,a)}},b.createSpan=function(a,b,c){if(a instanceof p)return a;return b===undefined?new p(a):c===undefined?new p(a,b):new p(a,b,c)},b.Span=p,b.Util.inherits(q,b.Span),q.prototype.getValue=function(){var a=this._arr[this._arr.length*Math.random()>>0];return a=="random"||a=="Random"?b.MathUtils.randomColor():a},b.createArraySpan=function(a){if(!a)return null;return a instanceof b.ArraySpan?a:new b.ArraySpan(a)},b.ArraySpan=q;var r=function(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=d!==undefined?d:1;};r.prototype={set:function(a,b,c,d){this.x=a,this.y=b,this.z=c,this.w=d;return this},clone:function(){return new b.Quaternion(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w;return this},setFromEuler:function(a){var b=Math.cos(a.x/2),c=Math.cos(a.y/2),d=Math.cos(a.z/2),e=Math.sin(a.x/2),f=Math.sin(a.y/2),g=Math.sin(a.z/2);this.x=e*c*d+b*f*g,this.y=b*f*d-e*c*g,this.z=b*c*g+e*f*d,this.w=b*c*d-e*f*g;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d,this.y=a.y*d,this.z=a.z*d,this.w=Math.cos(c);return this},normalize:function(){var a=this.length();a===0?(this.x=0,this.y=0,this.z=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w}},b.Quaternion=r,s.prototype={contains:function(a,b,c){return a<=this.right&&a>=this.x&&b<=this.bottom&&b>=this.y&&c<=this.depth&&c>=this.z?!0:!1}},b.Box=s,t.id=0,t.prototype={reset:function(a,c){this.life=b.Util.initValue(a,Infinity),this.easing=b.Util.initValue(c,b.ease.setEasingByName(b.ease.easeLinear));},normalizeForce:function(a){return a.scalar(b.MEASURE)},normalizeValue:function(a){return a*b.MEASURE},initialize:function(a){},applyBehaviour:function(a,b,c){if(!this.dead){this.age+=b;if(this.age>=this.life){this.energy=0,this.dead=!0;return}var d=this.easing(a.age/a.life);this.energy=Math.max(1-d,0);}},destroy:function(){}},b.Behaviour=t,u.prototype={init:function(){this.startTime=0,this.nextTime=this.timePan.getValue();},getValue:function(a){this.startTime+=a;if(this.startTime>=this.nextTime){this.init();return this.numPan.b==1?this.numPan.getValue("Float")>.5?1:0:this.numPan.getValue("Int")}return 0}},b.Rate=u,v.prototype.reset=function(){},v.prototype.init=function(a,b){b?this.initialize(b):this.initialize(a);},v.prototype.initialize=function(a){},b.Initialize=v;var w={initialize:function(a,c,d){var e=d.length;while(e--){var f=d[e];f instanceof b.Initialize?f.init(a,c):w.init(a,c,f);}w.bindEmitter(a,c);},init:function(a,c,d){b.Util.setPrototypeByObj(c,d),b.Util.setVectorByObj(c,d);},bindEmitter:function(a,b){a.bindEmitter&&(b.p.add(a.p),b.v.add(a.v),b.a.add(a.a),b.v.applyEuler(a.rotation));}};b.InitializeUtil=w,b.Util.inherits(x,b.Initialize),x.prototype.initialize=function(a){this.lifePan.a==Infinity||this.lifePan.a=="infi"?a.life=Infinity:a.life=this.lifePan.getValue();},b.Life=x,b.Util.inherits(y,b.Initialize),y.prototype.reset=function(){this.zones?this.zones.length=0:this.zones=[];var a=Array.prototype.slice.call(arguments);this.zones=this.zones.concat(a);},y.prototype.addZone=function(){var a=Array.prototype.slice.call(arguments);this.zones=this.zones.concat(a);},y.prototype.initialize=function(){return function(a){var b=this.zones[Math.random()*this.zones.length>>0];b.getPosition(),a.p.x=b.vector.x,a.p.y=b.vector.y,a.p.z=b.vector.z;}}(),b.Position=y,b.P=y,b.Util.inherits(z,b.Initialize),z.prototype.reset=function(a,c,d){a instanceof b.Vector3D?(this.radiusPan=b.createSpan(1),this.dir=a.clone(),this.tha=c*b.DR,this._useV=!0):a instanceof b.Polar3D?(this.tha=c*b.DR,this.dirVec=a.toVector3D(),this._useV=!1):(this.radiusPan=b.createSpan(a),this.dir=c.clone().normalize(),this.tha=d*b.DR,this._useV=!0);},z.prototype.normalize=function(a){return a*b.MEASURE},z.prototype.initialize=function(){var a,c=new b.Vector3D(0,0,1),d=new b.Vector3D(0,0,0);return function(e){a=this.tha*Math.random(),this._useV&&this.dirVec.copy(this.dir).scalar(this.radiusPan.getValue()),b.MathUtils.getNormal(this.dirVec,c),d.copy(this.dirVec).applyAxisAngle(c,a),d.applyAxisAngle(this.dirVec.normalize(),Math.random()*b.PI*2),e.v.copy(d);return this}}(),b.Velocity=z,b.V=z,b.Util.inherits(A,b.Initialize),A.prototype.initialize=function(a){a.mass=this.massPan.getValue();},b.Mass=A,b.Util.inherits(B,b.Initialize),B.prototype.reset=function(a,c,d){this.radius=b.createSpan(a,c,d);},B.prototype.initialize=function(a){a.radius=this.radius.getValue(),a.transform.oldRadius=a.radius;},b.Radius=B,b.Util.inherits(C,b.Initialize),C.prototype.initialize=function(a){var b=this.body.getValue();this.w?a.body={width:this.w,height:this.h,body:b}:a.body=b;},b.Body=C,b.Util.inherits(D,b.Behaviour),D.prototype.reset=function(a,c,d){this.force=this.normalizeForce(new b.Vector3D(a,c,d)),this.force.id=Math.random();},D.prototype.applyBehaviour=function(a,b,c){D._super_.prototype.applyBehaviour.call(this,a,b,c),a.a.add(this.force);},b.F=b.Force=D,b.Util.inherits(E,b.Behaviour),E.prototype.reset=function(a,c,d,e,f){this.targetPosition=b.Util.initValue(a,new b.Vector3D),this.radius=b.Util.initValue(d,1e3),this.force=b.Util.initValue(this.normalizeValue(c),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new b.Vector3D,this.lengthSq=0,e&&E._super_.prototype.reset.call(this,e,f);},E.prototype.applyBehaviour=function(a,b,c){E._super_.prototype.applyBehaviour.call(this,a,b,c),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(a.p),this.lengthSq=this.attractionForce.lengthSq(),this.lengthSq>4e-6&&this.lengthSq<this.radiusSq&&(this.attractionForce.normalize(),this.attractionForce.scalar(1-this.lengthSq/this.radiusSq),this.attractionForce.scalar(this.force),a.a.add(this.attractionForce));},b.Attraction=E,b.Util.inherits(F,b.Behaviour),F.prototype.reset=function(a,c,d,e,f,g){this.randomFoce=this.normalizeForce(new b.Vector3D(a,c,d)),this.delayPan=b.createSpan(e||.03),this.time=0,f&&F._super_.prototype.reset.call(this,f,g);},F.prototype.applyBehaviour=function(a,c,d){F._super_.prototype.applyBehaviour.call(this,a,c,d),this.time+=c;if(this.time>=this.delayPan.getValue()){var e=b.MathUtils.randomAToB(-this.randomFoce.x,this.randomFoce.x),f=b.MathUtils.randomAToB(-this.randomFoce.y,this.randomFoce.y),g=b.MathUtils.randomAToB(-this.randomFoce.z,this.randomFoce.z);a.a.addValue(e,f,g),this.time=0;}},b.RandomDrift=F,b.Util.inherits(G,b.Attraction),G.prototype.reset=function(a,b,c,d,e){G._super_.prototype.reset.call(this,a,b,c,d,e),this.force*=-1;},b.Repulsion=G,b.Util.inherits(H,b.Force),H.prototype.reset=function(a,b,c){H._super_.prototype.reset.call(this,0,-a,0,b,c);},b.Gravity=H,b.G=H,b.Util.inherits(I,b.Behaviour),I.prototype.reset=function(a,c,d,e,f){this.emitter=a,this.useMass=c,this.callback=d,this.particles=[],this.delta=new b.Vector3D,e&&I._super_.prototype.reset.call(this,e,f);},I.prototype.applyBehaviour=function(a,b,c){var d=this.emitter?this.emitter.particles.slice(c):this.particles.slice(c),e,f,g,h,i,j,k=d.length;while(k--){e=d[k];if(e==a)continue;this.delta.copy(e.p).sub(a.p),f=this.delta.lengthSq(),h=a.radius+e.radius,f<=h*h&&(g=h-Math.sqrt(f),g+=.5,i=this._getAverageMass(a,e),j=this._getAverageMass(e,a),a.p.add(this.delta.clone().normalize().scalar(g*-i)),e.p.add(this.delta.normalize().scalar(g*j)),this.callback&&this.callback(a,e));}},I.prototype._getAverageMass=function(a,b){return this.useMass?b.mass/(a.mass+b.mass):.5},b.Collision=I,b.Util.inherits(J,b.Behaviour),J.prototype.reset=function(a,c,d,e){var f,g;typeof a=="string"?(g=a,f=c):(g=c,f=a),this.zone=f,this.zone.crossType=b.Util.initValue(g,"dead"),d&&J._super_.prototype.reset.call(this,d,e);},J.prototype.applyBehaviour=function(a,b,c){J._super_.prototype.applyBehaviour.call(this,a,b,c),this.zone.crossing.call(this.zone,a);},b.CrossZone=J,b.Util.inherits(K,b.Behaviour),K.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createSpan(b.Util.initValue(a,1)),this.b=b.createSpan(c),d&&K._super_.prototype.reset.call(this,d,e);},K.prototype.initialize=function(a){a.useAlpha=!0,a.transform.alphaA=this.a.getValue(),this._same?a.transform.alphaB=a.transform.alphaA:a.transform.alphaB=this.b.getValue();},K.prototype.applyBehaviour=function(a,c,d){K._super_.prototype.applyBehaviour.call(this,a,c,d),a.alpha=b.MathUtils.lerp(a.transform.alphaA,a.transform.alphaB,this.energy),a.alpha<.002&&(a.alpha=0);},b.Alpha=K,b.Util.inherits(L,b.Behaviour),L.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createSpan(b.Util.initValue(a,1)),this.b=b.createSpan(c),d&&L._super_.prototype.reset.call(this,d,e);},L.prototype.initialize=function(a){a.transform.scaleA=this.a.getValue(),a.transform.oldRadius=a.radius,this._same?a.transform.scaleB=a.transform.scaleA:a.transform.scaleB=this.b.getValue();},L.prototype.applyBehaviour=function(a,c,d){L._super_.prototype.applyBehaviour.call(this,a,c,d),a.scale=b.MathUtils.lerp(a.transform.scaleA,a.transform.scaleB,this.energy),a.scale<5e-4&&(a.scale=0),a.radius=a.transform.oldRadius*a.scale;},b.Scale=L,b.Util.inherits(M,b.Behaviour),M.prototype.reset=function(a,c,d,e,f){this.a=a||0,this.b=c||0,this.c=d||0,a===undefined||a=="same"?this._type="same":c==undefined?this._type="set":d===undefined?this._type="to":(this._type="add",this.a=b.createSpan(this.a*b.DR),this.b=b.createSpan(this.b*b.DR),this.c=b.createSpan(this.c*b.DR)),e&&M._super_.prototype.reset.call(this,e,f);},M.prototype.initialize=function(a){switch(this._type){case"same":break;case"set":this._setRotation(a.rotation,this.a);break;case"to":a.transform.fR=a.transform.fR||new b.Vector3D,a.transform.tR=a.transform.tR||new b.Vector3D,this._setRotation(a.transform.fR,this.a),this._setRotation(a.transform.tR,this.b);break;case"add":a.transform.addR=new b.Vector3D(this.a.getValue(),this.b.getValue(),this.c.getValue());}},M.prototype._setRotation=function(a,c){a=a||new b.Vector3D;if(c=="random"){var d=b.MathUtils.randomAToB(-b.PI,b.PI),e=b.MathUtils.randomAToB(-b.PI,b.PI),f=b.MathUtils.randomAToB(-b.PI,b.PI);a.set(d,e,f);}else c instanceof b.Vector3D&&a.copy(c);},M.prototype.applyBehaviour=function(a,c,d){M._super_.prototype.applyBehaviour.call(this,a,c,d);switch(this._type){case"same":a.rotation||(a.rotation=new b.Vector3D),a.rotation.eulerFromDir(a.v);break;case"set":break;case"to":a.rotation.x=b.MathUtils.lerp(a.transform.fR.x,a.transform.tR.x,this.energy),a.rotation.y=b.MathUtils.lerp(a.transform.fR.y,a.transform.tR.y,this.energy),a.rotation.z=b.MathUtils.lerp(a.transform.fR.z,a.transform.tR.z,this.energy);break;case"add":a.rotation.add(a.transform.addR);}},b.Rotate=M,b.Util.inherits(N,b.Behaviour),N.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createArraySpan(a),this.b=b.createArraySpan(c),d&&N._super_.prototype.reset.call(this,d,e);},N.prototype.initialize=function(a){a.transform.colorA=b.ColorUtil.getRGB(this.a.getValue()),a.useColor=!0,this._same?a.transform.colorB=a.transform.colorA:a.transform.colorB=b.ColorUtil.getRGB(this.b.getValue());},N.prototype.applyBehaviour=function(a,c,d){N._super_.prototype.applyBehaviour.call(this,a,c,d),this._same?(a.color.r=a.transform.colorA.r,a.color.g=a.transform.colorA.g,a.color.b=a.transform.colorA.b):(a.color.r=b.MathUtils.lerp(a.transform.colorA.r,a.transform.colorB.r,this.energy),a.color.g=b.MathUtils.lerp(a.transform.colorA.g,a.transform.colorB.g,this.energy),a.color.b=b.MathUtils.lerp(a.transform.colorA.b,a.transform.colorB.b,this.energy));},b.Color=N,b.Util.inherits(O,b.Behaviour),O.prototype.reset=function(a,c,d,e,f){this.pos?this.pos.set(a,c,d):this.pos=new b.Vector3D(a,c,d),this.spring=e||.1,this.friction=f||.98;},O.prototype.applyBehaviour=function(a,b,c){O._super_.prototype.applyBehaviour.call(this,a,b,c),a.v.x+=(this.pos.x-a.p.x)*this.spring,a.v.y+=(this.pos.y-a.p.y)*this.spring,a.v.z+=(this.pos.z-a.p.z)*this.spring;},b.Spring=O,P.ID=0,b.Util.inherits(P,b.Particle),b.EventDispatcher.initialize(P.prototype),P.prototype.emit=function(a,c){this.currentEmitTime=0,this.totalEmitTimes=b.Util.initValue(a,Infinity),c==!0||c=="life"||c=="destroy"?this.life=a=="once"?1:this.totalEmitTimes:isNaN(c)||(this.life=c),this.rate.init();},P.prototype.stopEmit=function(){this.totalEmitTimes=-1,this.currentEmitTime=0;},P.prototype.removeAllParticles=function(){var a=this.particles.length;while(a--)this.particles[a].dead=!0;},P.prototype.createParticle=function(a,c){var d=this.parent.pool.get(b.Particle);this.setupParticle(d,a,c),this.parent&&this.parent.dispatchEvent("PARTICLE_CREATED",d),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_CREATED",d);return d},P.prototype.addSelfInitialize=function(a){a.init?a.init(this):this.initAll();},P.prototype.addInitialize=function(){var a=arguments.length;while(a--)this.initializes.push(arguments[a]);},P.prototype.removeInitialize=function(a){var b=this.initializes.indexOf(a);b>-1&&this.initializes.splice(b,1);},P.prototype.removeInitializers=function(){b.Util.destroyArray(this.initializes);},P.prototype.addBehaviour=function(){var a=arguments.length;while(a--)this.behaviours.push(arguments[a]);},P.prototype.removeBehaviour=function(a){var b=this.behaviours.indexOf(a);b>-1&&this.behaviours.splice(b,1);},P.prototype.removeAllBehaviours=function(){b.Util.destroyArray(this.behaviours);},P.prototype.integrate=function(a){var c=1-this.damping;b.integrator.integrate(this,a,c);var d=this.particles.length;while(d--){var e=this.particles[d];e.update(a,d),b.integrator.integrate(e,a,c),this.parent&&this.parent.dispatchEvent("PARTICLE_UPDATE",e),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_UPDATE",e);}},P.prototype.emitting=function(a){if(this.totalEmitTimes=="once"){var b=this.rate.getValue(99999);b>0&&(this.cID=b);while(b--)this.createParticle();this.totalEmitTimes="none";}else if(!isNaN(this.totalEmitTimes)){this.currentEmitTime+=a;if(this.currentEmitTime<this.totalEmitTimes){var b=this.rate.getValue(a);b>0&&(this.cID=b);while(b--)this.createParticle();}}},P.prototype.update=function(a){this.age+=a,(this.dead||this.age>=this.life)&&this.destroy(),this.emitting(a),this.integrate(a);var c,d=this.particles.length;while(d--)c=this.particles[d],c.dead&&(this.parent&&this.parent.dispatchEvent("PARTICLE_DEAD",c),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_DEAD",c),this.parent.pool.expire(c.reset()),this.particles.splice(d,1));},P.prototype.setupParticle=function(a,c,d){var e=this.initializes,f=this.behaviours;c&&(b.Util.isArray(c)?e=c:e=[c]),d&&(b.Util.isArray(d)?f=d:f=[d]),b.InitializeUtil.initialize(this,a,e),a.addBehaviours(f),a.parent=this,this.particles.push(a);},P.prototype.destroy=function(){this.dead=!0,this.energy=0,this.totalEmitTimes=-1,this.particles.length==0&&(this.removeInitializers(),this.removeAllBehaviours(),this.parent&&this.parent.removeEmitter(this));},b.Emitter=P,b.Util.inherits(Q,b.Emitter),Q.prototype.addSelfBehaviour=function(){var a=arguments.length,b;for(b=0;b<a;b++)this.selfBehaviours.push(arguments[b]);},Q.prototype.removeSelfBehaviour=function(a){var b=this.selfBehaviours.indexOf(a);b>-1&&this.selfBehaviours.splice(b,1);},Q.prototype.update=function(a){Q._super_.prototype.update.call(this,a);if(!this.sleep){var b=this.selfBehaviours.length,c;for(c=0;c<b;c++)this.selfBehaviours[c].applyBehaviour(this,a,c);}},b.BehaviourEmitter=Q,b.Util.inherits(R,b.Emitter),R.prototype.initEventHandler=function(){var a=this;this.mousemoveHandler=function(b){a.mousemove.call(a,b);},this.mousedownHandler=function(b){a.mousedown.call(a,b);},this.mouseupHandler=function(b){a.mouseup.call(a,b);},this.mouseTarget.addEventListener("mousemove",this.mousemoveHandler,!1);},R.prototype.emit=function(){this._allowEmitting=!0;},R.prototype.stopEmit=function(){this._allowEmitting=!1;},R.prototype.setCameraAndCanvas=function(a,b){this.camera=a,this.canvas=b;},R.prototype.setCameraAndRenderer=function(a,b){this.camera=a,this.renderer=b,this.canvas=b.domElement;},R.prototype.mousemove=function(a){var c=this.canvas.getBoundingClientRect(),d=a.clientX-c.left,e=a.clientY-c.top,f=this.renderer?this.renderer.getPixelRatio():1;d*=f,e*=f,this.mouse.x+=(d-this.mouse.x)*this.ease,this.mouse.y+=(e-this.mouse.y)*this.ease,this.p.copy(b.THREEUtil.toSpacePos(this.mouse,this.camera,this.canvas,this.renderer)),this._allowEmitting&&R._super_.prototype.emit.call(this,"once");},R.prototype.destroy=function(){R._super_.prototype.destroy.call(this),this.mouseTarget.removeEventListener("mousemove",this.mousemoveHandler,!1);},b.FollowEmitter=R;var S=S||{easeLinear:function(a){return a},easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return -(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){if((a/=.5)<1)return .5*Math.pow(a,2);return -0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){if((a/=.5)<1)return .5*Math.pow(a,3);return .5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return -(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){if((a/=.5)<1)return .5*Math.pow(a,4);return -0.5*((a-=2)*Math.pow(a,3)-2)},easeInSine:function(a){return -Math.cos(a*(b.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(b.PI/2))},easeInOutSine:function(a){return -0.5*(Math.cos(b.PI*a)-1)},easeInExpo:function(a){return a===0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a===1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){if(a===0)return 0;if(a===1)return 1;if((a/=.5)<1)return .5*Math.pow(2,10*(a-1));return .5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return -(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){if((a/=.5)<1)return -0.5*(Math.sqrt(1-a*a)-1);return .5*(Math.sqrt(1-(a-=2)*a)+1)},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return (a=a-1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;if((a/=.5)<1)return .5*a*a*(((b*=1.525)+1)*a-b);return .5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},setEasingByName:function(a){return S[a]?S[a]:S.easeLinear}};for(var T in S)T!="setEasingByName"&&(b[T]=S[T]);b.ease=S,U.prototype={init:function(a){var b=this;this.proton=a,this.proton.addEventListener("PROTON_UPDATE",function(a){b.onProtonUpdate.call(b,a);}),this.proton.addEventListener("PARTICLE_CREATED",function(a){b.onParticleCreated.call(b,a);}),this.proton.addEventListener("PARTICLE_UPDATE",function(a){b.onParticleUpdate.call(b,a);}),this.proton.addEventListener("PARTICLE_DEAD",function(a){b.onParticleDead.call(b,a);});},remove:function(a){this.proton=null;},onParticleCreated:function(a){},onParticleUpdate:function(a){},onParticleDead:function(a){},onProtonUpdate:function(a){}},b.BaseRender=U,b.Util.inherits(V,b.BaseRender),V.prototype.onProtonUpdate=function(){},V.prototype.onParticleCreated=function(a){if(!a.target){a.body||(a.body=this._body),a.target=this._targetPool.get(a.body);if(a.useAlpha||a.useColor)a.target.material.__puid=b.PUID.id(a.body.material),a.target.material=this._materialPool.get(a.target.material);}a.target&&(a.target.position.copy(a.p),this.container.add(a.target));},V.prototype.onParticleUpdate=function(a){a.target&&(a.target.position.copy(a.p),a.target.rotation.set(a.rotation.x,a.rotation.y,a.rotation.z),this.scale(a),a.useAlpha&&(a.target.material.opacity=a.alpha,a.target.material.transparent=!0),a.useColor&&a.target.material.color.copy(a.color));},V.prototype.scale=function(a){a.target.scale.set(a.scale,a.scale,a.scale);},V.prototype.onParticleDead=function(a){a.target&&((a.useAlpha||a.useColor)&&this._materialPool.expire(a.target.material),this._targetPool.expire(a.target),this.container.remove(a.target),a.target=null);},b.MeshRender=V,b.Util.inherits(W,b.BaseRender),W.prototype.onProtonUpdate=function(){},W.prototype.onParticleCreated=function(b){b.target||(b.target=new a.Vector3),b.target.copy(b.p),this.points.geometry.vertices.push(b.target);},W.prototype.onParticleUpdate=function(a){a.target&&a.target.copy(a.p);},W.prototype.onParticleDead=function(a){if(a.target){var b=this.points.geometry.vertices.indexOf(a.target);b>-1&&this.points.geometry.vertices.splice(b,1),a.target=null;}},b.PointsRender=W,b.Util.inherits(X,b.MeshRender),X.prototype.scale=function(a){a.target.scale.set(a.scale*a.radius,a.scale*a.radius,1);},b.SpriteRender=X,b.Util.inherits(Y,b.BaseRender),Y.prototype.onProtonUpdate=function(){},Y.prototype.onParticleCreated=function(a){},Y.prototype.onParticleUpdate=function(a){},Y.prototype.onParticleDead=function(a){},b.CustomRender=Y,Z.prototype={getPosition:function(){return null},crossing:function(a){switch(this.crossType){case"bound":this._bound(a);break;case"cross":this._cross(a);break;case"dead":this._dead(a);}},_dead:function(a){},_bound:function(a){},_cross:function(a){}},b.Zone=Z,b.Util.inherits($,b.Zone),$.prototype.getPosition=function(){this.random=Math.random(),this.vector.x=this.x1+this.random*(this.x2-this.x1),this.vector.y=this.y1+this.random*(this.y2-this.y1),this.vector.z=this.z1+this.random*(this.z2-this.z1);return this.vector},$.prototype.crossing=function(a){this.log&&(console.error("Sorry LineZone does not support crossing method"),this.log=!1);},b.LineZone=$,b.Util.inherits(_,b.Zone),_.prototype.getPosition=function(){var a,c,d;return function(){this.random=Math.random(),d=this.random*this.radius,a=b.PI*Math.random(),c=b.PI*2*Math.random(),this.vector.x=this.x+d*Math.sin(a)*Math.cos(c),this.vector.y=this.y+d*Math.sin(c)*Math.sin(a),this.vector.z=this.z+d*Math.cos(a);return this.vector}}(),_.prototype._dead=function(a){var b=a.p.distanceTo(this);b-a.radius>this.radius&&(a.dead=!0);},_.prototype._bound=function(){var a=new b.Vector3D,c=new b.Vector3D,d;return function(b){var e=b.p.distanceTo(this);e+b.radius>=this.radius&&(a.copy(b.p).sub(this).normalize(),c.copy(b.v),d=2*c.dot(a),b.v.sub(a.scalar(d)));}}(),_.prototype._cross=function(a){this.log&&(console.error("Sorry SphereZone does not support _cross method"),this.log=!1);},b.SphereZone=_,b.Util.inherits(ba,b.Zone),ba.prototype.getPosition=function(){var a=this.geometry.vertices,b=a[a.length*Math.random()>>0];this.vector.x=b.x*this.scale,this.vector.y=b.y*this.scale,this.vector.z=b.z*this.scale;return this.vector},ba.prototype.crossing=function(a){this.log&&(console.error("Sorry MeshZone does not support crossing method"),this.log=!1);},b.MeshZone=ba,b.Util.inherits(bb,b.Zone),bb.prototype.getPosition=function(){this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z;return this.vector},bb.prototype.crossing=function(a){this.log&&(console.error("Sorry PointZone does not support crossing method"),this.log=!1);},b.PointZone=bb,b.Util.inherits(bc,b.Zone),bc.prototype.getPosition=function(){this.vector.x=this.x+b.MathUtils.randomAToB(-0.5,.5)*this.width,this.vector.y=this.y+b.MathUtils.randomAToB(-0.5,.5)*this.height,this.vector.z=this.z+b.MathUtils.randomAToB(-0.5,.5)*this.depth;return this.vector},bc.prototype._dead=function(a){a.p.x+a.radius<this.x-this.width/2?a.dead=!0:a.p.x-a.radius>this.x+this.width/2&&(a.dead=!0),a.p.y+a.radius<this.y-this.height/2?a.dead=!0:a.p.y-a.radius>this.y+this.height/2&&(a.dead=!0),a.p.z+a.radius<this.z-this.depth/2?a.dead=!0:a.p.z-a.radius>this.z+this.depth/2&&(a.dead=!0);},bc.prototype._bound=function(a){a.p.x-a.radius<this.x-this.width/2?(a.p.x=this.x-this.width/2+a.radius,a.v.x*=-this.friction,this._static(a,"x")):a.p.x+a.radius>this.x+this.width/2&&(a.p.x=this.x+this.width/2-a.radius,a.v.x*=-this.friction,this._static(a,"x")),a.p.y-a.radius<this.y-this.height/2?(a.p.y=this.y-this.height/2+a.radius,a.v.y*=-this.friction,this._static(a,"y")):a.p.y+a.radius>this.y+this.height/2&&(a.p.y=this.y+this.height/2-a.radius,a.v.y*=-this.friction,this._static(a,"y")),a.p.z-a.radius<this.z-this.depth/2?(a.p.z=this.z-this.depth/2+a.radius,a.v.z*=-this.friction,this._static(a,"z")):a.p.z+a.radius>this.z+this.depth/2&&(a.p.z=this.z+this.depth/2-a.radius,a.v.z*=-this.friction,this._static(a,"z"));},bc.prototype._static=function(a,b){a.v[b]*a.a[b]>0||Math.abs(a.v[b])<Math.abs(a.a[b])*.0167*this.max&&(a.v[b]=0,a.a[b]=0);},bc.prototype._cross=function(a){a.p.x+a.radius<this.x-this.width/2&&a.v.x<=0?a.p.x=this.x+this.width/2+a.radius:a.p.x-a.radius>this.x+this.width/2&&a.v.x>=0&&(a.p.x=this.x-this.width/2-a.radius),a.p.y+a.radius<this.y-this.height/2&&a.v.y<=0?a.p.y=this.y+this.height/2+a.radius:a.p.y-a.radius>this.y+this.height/2&&a.v.y>=0&&(a.p.y=this.y-this.height/2-a.radius),a.p.z+a.radius<this.z-this.depth/2&&a.v.z<=0?a.p.z=this.z+this.depth/2+a.radius:a.p.z-a.radius>this.z+this.depth/2&&a.v.z>=0&&(a.p.z=this.z-this.depth/2-a.radius);},b.BoxZone=bc,b.Util.inherits(bd,b.Zone),bd.prototype.getPosition=function(){var a=new b.Vector3D,c;return function(){c=this.renderer.domElement,a.x=Math.random()*c.width,a.y=Math.random()*c.height,this.vector.copy(b.THREEUtil.toSpacePos(a,this.camera,c));return this.vector}}(),bd.prototype._dead=function(a){var c=b.THREEUtil.toScreenPos(a.p,this.camera,this.renderer.domElement),d=this.renderer.domElement;c.y+a.radius<-this.dis&&this.d1?a.dead=!0:c.y-a.radius>d.height+this.dis&&this.d3&&(a.dead=!0),c.x+a.radius<-this.dis&&this.d4?a.dead=!0:c.x-a.radius>d.width+this.dis&&this.d2&&(a.dead=!0);},bd.prototype._cross=function(){var a=new b.Vector3D;return function(c){var d=b.THREEUtil.toScreenPos(c.p,this.camera,this.renderer.domElement),e=this.renderer.domElement;d.y+c.radius<-this.dis?(a.x=d.x,a.y=e.height+this.dis+c.radius,c.p.y=b.THREEUtil.toSpacePos(a,this.camera,e).y):d.y-c.radius>e.height+this.dis&&(a.x=d.x,a.y=-this.dis-c.radius,c.p.y=b.THREEUtil.toSpacePos(a,this.camera,e).y),d.x+c.radius<-this.dis?(a.y=d.y,a.x=e.width+this.dis+c.radius,c.p.x=b.THREEUtil.toSpacePos(a,this.camera,e).x):d.x-c.radius>e.width+this.dis&&(a.y=d.y,a.x=-this.dis-c.radius,c.p.x=b.THREEUtil.toSpacePos(a,this.camera,e).x);}}(),bd.prototype._bound=function(a){var c=b.THREEUtil.toScreenPos(a.p,this.camera,this.renderer.domElement),d=this.renderer.domElement;c.y+a.radius<-this.dis?a.v.y*=-1:c.y-a.radius>d.height+this.dis&&(a.v.y*=-1),c.x+a.radius<-this.dis?a.v.y*=-1:c.x-a.radius>d.width+this.dis&&(a.v.y*=-1);},b.ScreenZone=bd;var be=function(){if(window.console&&window.console.trace){var a=Array.prototype.slice.call(arguments),b=arguments[0]+"";if(b.indexOf("+")==0){var c=parseInt(arguments[0]);be.once<c&&(a.shift(),console.trace.apply(console,a),be.once++);}else a.unshift("+15"),be.apply(console,a);}};be.once=0,b.log=be;var bf=bf||{addEventListener:function(a,b){a.addEventListener("PROTON_UPDATE",function(a){b(a);});},drawZone:function(c,d,e){var f,g,h;e instanceof b.PointZone?f=new a.SphereGeometry(15):e instanceof b.LineZone||(e instanceof b.BoxZone?f=new a.BoxGeometry(e.width,e.height,e.depth):e instanceof b.SphereZone?f=new a.SphereGeometry(e.radius,10,10):e instanceof b.MeshZone&&(e.geometry instanceof a.Geometry?f=e.geometry:f=e.geometry.geometry,f=new a.SphereGeometry(e.radius,10,10))),g=new a.MeshBasicMaterial({color:"#2194ce",wireframe:!0}),h=new a.Mesh(f,g),d.add(h),this.addEventListener(c,function(a){h.position.set(e.x,e.y,e.z);});},drawEmitter:function(b,c,d,e){var f=new a.OctahedronGeometry(15),g=new a.MeshBasicMaterial({color:e||"#aaa",wireframe:!0}),h=new a.Mesh(f,g);c.add(h),this.addEventListener(b,function(){h.position.copy(d.p),h.rotation.set(d.rotation.x,d.rotation.y,d.rotation.z);});},renderInfo:function(){function b(a){var b=a.emitters[0];return Math.round(b.p.x)+","+Math.round(b.p.y)+","+Math.round(b.p.z)}function a(a,b){var c=b=="material"?"_materialPool":"_targetPool",d=a.renderers[0];return d[c].cID}return function(c,d){this.addInfo(d);var e="";switch(this._infoType){case 2:e+="emitter:"+c.emitters.length+"<br>",e+="em speed:"+c.emitters[0].cID+"<br>",e+="pos:"+b(c);break;case 3:e+=c.renderers[0].name+"<br>",e+="target:"+a(c,"target")+"<br>",e+="material:"+a(c,"material");break;default:e+="particles:"+c.getCount()+"<br>",e+="pool:"+c.pool.getCount()+"<br>",e+="total:"+(c.getCount()+c.pool.getCount());}this._infoCon.innerHTML=e;}}(),addInfo:function(){return function(a){var b=this;if(!this._infoCon){this._infoCon=document.createElement("div"),this._infoCon.style.cssText=["position:fixed;bottom:0px;left:0;cursor:pointer;","opacity:0.9;z-index:10000;padding:10px;font-size:12px;","width:120px;height:50px;background-color:#002;color:#0ff;"].join(""),this._infoType=1,this._infoCon.addEventListener("click",function(a){b._infoType++,b._infoType>3&&(b._infoType=1);},!1);var c,d;switch(a){case 2:c="#201",d="#f08";break;case 3:c="#020",d="#0f0";break;default:c="#002",d="#0ff";}this._infoCon.style["background-color"]=c,this._infoCon.style.color=d;}this._infoCon.parentNode||document.body.appendChild(this._infoCon);}}()};b.Debug=bf;return b});
87218
+ }(three_proton_min));
87219
+
87220
+ var Proton = three_proton_min.exports;const PARTICLE_EMITTER_TYPES = {
87190
87221
  SINGLE: 'SINGLE',
87191
87222
  GROUP: 'GROUP'
87192
87223
  };let ParticleEmitter = /*#__PURE__*/function (_Entity) {
@@ -87210,6 +87241,11 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
87210
87241
  _this.options = { ...options,
87211
87242
  name
87212
87243
  };
87244
+ _this.particleConfig = {};
87245
+ _this.preset = null;
87246
+ _this._sceneEmitter = false;
87247
+ _this.isUsingHelper = undefined;
87248
+ _this.holder = undefined;
87213
87249
 
87214
87250
  _this.setSystem();
87215
87251
 
@@ -87227,6 +87263,16 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
87227
87263
  }
87228
87264
 
87229
87265
  _createClass(ParticleEmitter, [{
87266
+ key: "setParticleConfig",
87267
+ value: function setParticleConfig(config) {
87268
+ this.particleConfig = config;
87269
+ }
87270
+ }, {
87271
+ key: "getParticleConfig",
87272
+ value: function getParticleConfig() {
87273
+ return this.particleConfig;
87274
+ }
87275
+ }, {
87230
87276
  key: "setBody",
87231
87277
  value: function setBody(_ref) {
87232
87278
  let {
@@ -87242,13 +87288,13 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
87242
87288
  key: "addToScene",
87243
87289
  value: function addToScene() {
87244
87290
  const {
87245
- addUniverse = true
87291
+ addUniverse = true,
87292
+ skipSceneAdd = false
87246
87293
  } = this.options;
87294
+ if (skipSceneAdd) return;
87247
87295
 
87248
87296
  if (this.hasBody()) {
87249
87297
  Scene$1.add(this.getBody(), this, addUniverse);
87250
- } else {
87251
- console.warn(ELEMENT_NOT_SET);
87252
87298
  }
87253
87299
  }
87254
87300
  }, {
@@ -87269,23 +87315,14 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
87269
87315
  }, {
87270
87316
  key: "isSystemDead",
87271
87317
  value: function isSystemDead() {
87272
- return this.system.finished;
87318
+ return this.hasSystem() && this.system.dead;
87273
87319
  }
87274
87320
  }, {
87275
87321
  key: "setSystem",
87276
87322
  value: function setSystem() {
87277
- const {
87278
- container = this.getBody(),
87279
- autostart = false,
87280
- particles = {},
87281
- system = {}
87282
- } = this.options;
87283
- this.system = new E({
87284
- container,
87285
- autostart,
87286
- particles,
87287
- system
87288
- });
87323
+ // Base implementation is a no-op.
87324
+ // Subclasses (ProtonParticleEmitter) override this to create their system.
87325
+ this.system = null;
87289
87326
  }
87290
87327
  }, {
87291
87328
  key: "getSystem",
@@ -87295,278 +87332,126 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
87295
87332
  }, {
87296
87333
  key: "emit",
87297
87334
  value: function emit() {
87298
- if (this.hasSystem()) {
87299
- this.system.start(...arguments);
87300
- }
87301
-
87302
87335
  return this;
87303
87336
  }
87304
87337
  }, {
87305
87338
  key: "stop",
87306
- value: function stop() {
87307
- if (this.hasSystem()) {
87308
- this.system.stop();
87309
- }
87310
- }
87339
+ value: function stop() {}
87311
87340
  }, {
87312
87341
  key: "syncParticleEmitter",
87313
- value: function syncParticleEmitter() {
87314
- if (this.hasSystem()) {
87315
- const {
87316
- position,
87317
- rotation
87318
- } = this.getWorldTransform();
87319
- this.system.particleSystem.position.set(position.x, position.y, position.z);
87320
- this.system.particleSystem.rotation.set(rotation.x, rotation.y, rotation.z);
87321
- }
87322
- }
87342
+ value: function syncParticleEmitter() {}
87323
87343
  }, {
87324
- key: "dispose",
87325
- value: function dispose() {
87326
- _get(_getPrototypeOf(ParticleEmitter.prototype), "dispose", this).call(this);
87327
- }
87328
- }, {
87329
- key: "update",
87330
- value: function update(dt) {
87331
- _get(_getPrototypeOf(ParticleEmitter.prototype), "update", this).call(this, dt);
87332
-
87333
- if (this.hasSystem() && !this.isSystemDead()) {
87334
- this.system.update(dt);
87335
- }
87336
-
87337
- this.syncParticleEmitter();
87338
- }
87339
- }]);
87340
-
87341
- return ParticleEmitter;
87342
- }(Entity);let Fountain = /*#__PURE__*/function (_ParticleEmitter) {
87343
- _inherits(Fountain, _ParticleEmitter);
87344
-
87345
- var _super = _createSuper(Fountain);
87346
-
87347
- function Fountain(_ref) {
87348
- var _this;
87349
-
87350
- let {
87351
- container,
87352
- autostart,
87353
- particles,
87354
- system
87355
- } = _ref;
87356
-
87357
- _classCallCheck(this, Fountain);
87344
+ key: "addHolder",
87345
+ value: function addHolder() {
87346
+ let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "particleholder";
87347
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;
87348
+ const holderSprite = new HelperSprite(size, size, name, {
87349
+ name
87350
+ });
87358
87351
 
87359
- const options = {
87360
- container,
87361
- autostart,
87362
- particles: {
87363
- ttl: 10,
87364
- globalSize: 5,
87365
- velocity: new N.SphereRandomizer(12.5),
87366
- velocityBonus: new Vector3$1(0, 25, 0),
87367
- particlesCount: 1000,
87368
- blending: "blend",
87369
- gravity: -10,
87370
- startAlpha: 1,
87371
- endAlpha: 0,
87372
- startColor: new N.ColorsRandomizer(),
87373
- endColor: new N.ColorsRandomizer(),
87374
- startAlphaChangeAt: 0,
87375
- onUpdate: particle => {
87376
- let floorY = -10;
87377
-
87378
- if (particle.position.y < floorY) {
87379
- particle.position.y = floorY;
87380
- particle.velocity.y *= -0.5;
87381
- particle.velocity.x *= 0.5;
87382
- particle.velocity.z *= 0.5;
87383
- }
87384
- },
87385
- ...particles
87386
- },
87387
- system: {
87388
- particlesCount: 100,
87389
- emitters: new k({
87390
- onInterval: new N.MinMaxRandomizer(0, 5),
87391
- interval: new N.MinMaxRandomizer(0, 0.25)
87392
- }),
87393
- speed: 1,
87394
- ...system
87352
+ if (holderSprite) {
87353
+ holderSprite.setSizeAttenuation(false);
87354
+ holderSprite.setDepthTest(false);
87355
+ holderSprite.setDepthWrite(false);
87356
+ holderSprite.setSerializable(false);
87357
+ holderSprite.setPosition(this.getPosition());
87358
+ holderSprite.addTags([TAGS.HELPER, TAGS.PARTICLES.HELPER, TAGS.PARTICLES.HOLDER, name]);
87359
+ holderSprite.setHelperTarget(this);
87360
+ this.holder = holderSprite;
87361
+ return true;
87395
87362
  }
87396
- };
87397
- _this = _super.call(this, options);
87398
-
87399
- _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.FOUNTAIN);
87400
-
87401
- return _this;
87402
- }
87403
-
87404
- return Fountain;
87405
- }(ParticleEmitter);var three_proton_min = {exports: {}};var require$$0 = /*@__PURE__*/getAugmentedNamespace(three_module);/*!
87406
- * three.proton v0.2.0
87407
- * https://github.com/drawcall/three.proton
87408
- *
87409
- * Copyright 2011-2020, ajiemath
87410
- * Licensed under the MIT license
87411
- * http://www.opensource.org/licenses/mit-license
87412
- *
87413
- */
87414
-
87415
- (function (module, exports) {
87416
- (function(a,b){module.exports=b(require$$0);})(commonjsGlobal,function(a){function bd(a,b,c,d){bd._super_.call(this),this.camera=a,this.renderer=b,this.dis=c||20,d=d||"1234";for(var e=1;e<5;e++)this["d"+e]=d.indexOf(e+"")>=0;this.name="ScreenZone";}function bc(a,c,d,e,f,g){var h,i,j,k,l,e;bc._super_.call(this),b.Util.isUndefined(c,d,e,f,g)?(h=i=j=0,k=l=e=a||100):b.Util.isUndefined(e,f,g)?(h=i=j=0,k=a,l=c,e=d):(h=a,i=c,j=d,k=e,l=f,e=g),this.x=h,this.y=i,this.z=j,this.width=k,this.height=l,this.depth=e,this.friction=.85,this.max=6;}function bb(a,c,d){var e,f,g;bb._super_.call(this),b.Util.isUndefined(a,c,d)?e=f=g=0:(e=a,f=c,g=d),this.x=e,this.y=f,this.z=g;}function ba(b,c){ba._super_.call(this),b instanceof a.Geometry?this.geometry=b:this.geometry=b.geometry,this.scale=c||1;}function _(a,c,d,e){var f,i;_._super_.call(this),b.Util.isUndefined(c,d,e)?(f=0,i=a||100):(f=a,i=e),this.x=f,this.y=f,this.z=f,this.radius=i,this.tha=this.phi=0;}function $(a,c,d,e,f,g){$._super_.call(this),a instanceof b.Vector3D?(this.x1=a.x,this.y1=a.y,this.z1=a.z,this.x2=e.x,this.y2=e.y,this.z2=e.z):(this.x1=a,this.y1=c,this.z1=d,this.x2=e,this.y2=f,this.z2=g);}function Z(){this.vector=new b.Vector3D(0,0,0),this.random=0,this.crossType="dead",this.log=!0;}function Y(){Y._super_.call(this),this.targetPool=new b.Pool,this.materialPool=new b.Pool,this.name="CustomRender";}function X(b){X._super_.call(this,b),this._body=new a.Sprite(new a.SpriteMaterial({color:16777215})),this.name="SpriteRender";}function W(a){W._super_.call(this),this.points=a,this.name="PointsRender";}function V(c){V._super_.call(this),this.container=c,this._targetPool=new b.Pool,this._materialPool=new b.Pool,this._body=new a.Mesh(new a.BoxGeometry(50,50,50),new a.MeshLambertMaterial({color:"#ff0000"})),this.name="MeshRender";}function U(){this.name="BaseRender";}function R(a,c,d){this.mouseTarget=b.Util.initValue(a,window),this.ease=b.Util.initValue(c,.7),this._allowEmitting=!1,this.mouse=new b.Vector3D,this.initEventHandler(),R._super_.call(this,d);}function Q(a){this.selfBehaviours=[],Q._super_.call(this,a);}function P(a){this.initializes=[],this.particles=[],this.behaviours=[],this.currentEmitTime=0,this.totalEmitTimes=-1,this.damping=.006,this.bindEmitter=!0,this.rate=new b.Rate(1,.1),P._super_.call(this,a),this.id="emitter_"+P.ID++,this.cID=0,this.name="Emitter";}function O(a,b,c,d,e,f,g){O._super_.call(this,f,g),O.prototype.reset(a,b,c,d,e),this.name="Spring";}function N(a,b,c,d){N._super_.call(this,c,d),this.reset(a,b),this.name="Color";}function M(a,b,c,d,e){M._super_.call(this,d,e),this.reset(a,b,c),this.name="Rotate";}function L(a,b,c,d){L._super_.call(this,c,d),this.reset(a,b),this.name="Scale";}function K(a,b,c,d){K._super_.call(this,c,d),this.reset(a,b),this.name="Alpha";}function J(a,b,c,d){J._super_.call(this,c,d),this.reset(a,b),this.name="CrossZone";}function I(a,b,c,d,e){I._super_.call(this,d,e),this.reset(a,b,c),this.name="Collision";}function H(a,b,c){H._super_.call(this,0,-a,0,b,c),this.name="Gravity";}function G(a,b,c,d,e){G._super_.call(this,a,b,c,d,e),this.force*=-1,this.name="Repulsion";}function F(a,b,c,d,e,f){F._super_.call(this,e,f),this.reset(a,b,c,d),this.time=0,this.name="RandomDrift";}function E(a,c,d,e,f){E._super_.call(this,e,f),this.targetPosition=b.Util.initValue(a,new b.Vector3D),this.radius=b.Util.initValue(d,1e3),this.force=b.Util.initValue(this.normalizeValue(c),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new b.Vector3D,this.lengthSq=0,this.name="Attraction";}function D(a,b,c,d,e){D._super_.call(this,d,e),D.prototype.reset.call(this,a,b,c),this.name="Force";}function C(a,c,d){C._super_.call(this),this.body=b.createArraySpan(a),this.w=c,this.h=b.Util.initValue(d,this.w);}function B(a,c,d){B._super_.call(this),this.radius=b.createSpan(a,c,d);}function A(a,c,d){A._super_.call(this),this.massPan=b.createSpan(a,c,d);}function z(a,c,d){z._super_.call(this),this.reset(a,c,d),this.dirVec=new b.Vector3D(0,0,0),this.name="Velocity";}function y(){y._super_.call(this),this.reset.apply(this,arguments);}function x(a,c,d){x._super_.call(this),this.lifePan=b.createSpan(a,c,d);}function v(){this.name="Initialize";}function u(a,c){this.numPan=b.createSpan(b.Util.initValue(a,1)),this.timePan=b.createSpan(b.Util.initValue(c,1)),this.startTime=0,this.nextTime=0,this.init();}function t(a,c){this.id="Behaviour_"+t.id++,this.life=b.Util.initValue(a,Infinity),this.easing=b.Util.initValue(c,b.ease.setEasingByName(b.ease.easeLinear)),this.age=0,this.energy=1,this.dead=!1,this.name="Behaviour";}function s(a,b,c,d,e,f){this.x=a,this.y=b,this.z=c,this.width=d,this.height=e,this.depth=f,this.bottom=this.y+this.height,this.right=this.x+this.width,this.right=this.x+this.width;}function q(a){this._arr=b.Util.isArray(a)?a:[a];}function p(a,c,d){this._isArray=!1,b.Util.isArray(a)?(this._isArray=!0,this.a=a):(this.a=b.Util.initValue(a,1),this.b=b.Util.initValue(c,this.a),this._center=b.Util.initValue(d,!1));}function j(){this.cID=0,this.list={};}function i(a){this.id="particle_"+i.ID++,this.name="Particle",this.reset("init"),b.Util.setPrototypeByObj(this,a);}function c(){this.initialize();}function b(a,c){this.preParticles=b.Util.initValue(a,b.POOL_MAX),this.integrationType=b.Util.initValue(c,b.EULER),this.emitters=[],this.renderers=[],this.pool=new b.Pool,b.integrator=new b.Integration(this.integrationType);}b.POOL_MAX=500,b.TIME_STEP=60,b.PI=3.142,b.DR=b.PI/180,b.MEASURE=100,b.EULER="euler",b.RK2="runge-kutta2",b.RK4="runge-kutta4",b.VERLET="verlet",b.PARTICLE_CREATED="partilcleCreated",b.PARTICLE_UPDATE="partilcleUpdate",b.PARTICLE_SLEEP="particleSleep",b.PARTICLE_DEAD="partilcleDead",b.PROTON_UPDATE="protonUpdate",b.PROTON_UPDATE_AFTER="protonUpdateAfter",b.EMITTER_ADDED="emitterAdded",b.EMITTER_REMOVED="emitterRemoved",b.bindEmtterEvent=!1,b.prototype={addRender:function(a){this.renderers.push(a),a.init(this);},removeRender:function(a){this.renderers.splice(this.renderers.indexOf(a),1),a.remove(this);},addEmitter:function(a){this.emitters.push(a),a.parent=this,this.dispatchEvent("EMITTER_ADDED",a);},removeEmitter:function(a){a.parent==this&&(this.emitters.splice(this.emitters.indexOf(a),1),a.parent=null,this.dispatchEvent("EMITTER_REMOVED",a));},update:function(a){this.dispatchEvent("PROTON_UPDATE",this);var b=a||.0167;if(b>0){var c=this.emitters.length;while(c--)this.emitters[c].update(b);}this.dispatchEvent("PROTON_UPDATE_AFTER",this);},getCount:function(){var a=0,b,c=this.emitters.length;for(b=0;b<c;b++)a+=this.emitters[b].particles.length;return a},destroy:function(){var a=0,b=this.emitters.length;for(a;a<b;a++)this.emitters[a].destroy(),delete this.emitters[a];this.emitters.length=0,this.pool.destroy();}},c.initialize=function(a){a.addEventListener=d.addEventListener,a.removeEventListener=d.removeEventListener,a.removeAllEventListeners=d.removeAllEventListeners,a.hasEventListener=d.hasEventListener,a.dispatchEvent=d.dispatchEvent;};var d=c.prototype;d._listeners=null,d.initialize=function(){},d.addEventListener=function(a,b){this._listeners?this.removeEventListener(a,b):this._listeners={},this._listeners[a]||(this._listeners[a]=[]),this._listeners[a].push(b);return b},d.removeEventListener=function(a,b){if(!!this._listeners){if(!this._listeners[a])return;var c=this._listeners[a];for(var d=0,e=c.length;d<e;d++)if(c[d]==b){e==1?delete this._listeners[a]:c.splice(d,1);break}}},d.removeAllEventListeners=function(a){a?this._listeners&&delete this._listeners[a]:this._listeners=null;},d.dispatchEvent=function(a,b){var c=!1,d=this._listeners;if(a&&d){var e=d[a];if(!e)return c;e=e.slice();var f,g=e.length;while(g--){var f=e[g];c=c||f(b);}}return !!c},d.hasEventListener=function(a){var b=this._listeners;return !!b&&!!b[a]},c.initialize(b.prototype),b.EventDispatcher=c;var e=e||{initValue:function(a,b){var a=a!=null&&a!=undefined?a:b;return a},isArray:function(a){return Object.prototype.toString.call(a)==="[object Array]"},destroyArray:function(a){a.length=0;},destroyObject:function(a){for(var b in a)delete a[b];},isUndefined:function(){for(var a in arguments){var b=arguments[a];if(b!==undefined)return !1}return !0},setVectorByObj:function(a,b){b.x!==undefined&&(a.p.x=b.x),b.y!==undefined&&(a.p.y=b.y),b.z!==undefined&&(a.p.z=b.z),b.vx!==undefined&&(a.v.x=b.vx),b.vy!==undefined&&(a.v.y=b.vy),b.vz!==undefined&&(a.v.z=b.vz),b.ax!==undefined&&(a.a.x=b.ax),b.ay!==undefined&&(a.a.y=b.ay),b.az!==undefined&&(a.a.z=b.az),b.p!==undefined&&a.p.copy(b.p),b.v!==undefined&&a.v.copy(b.v),b.a!==undefined&&a.a.copy(b.a),b.position!==undefined&&a.p.copy(b.position),b.velocity!==undefined&&a.v.copy(b.velocity),b.accelerate!==undefined&&a.a.copy(b.accelerate);},setPrototypeByObj:function(a,b,c){for(var d in b)a.hasOwnProperty(d)&&(c?c.indexOf(d)<0&&(a[d]=e._getValue(b[d])):a[d]=e._getValue(b[d]));return a},_getValue:function(a){return a instanceof p?a.getValue():a},inherits:function(a,b){a._super_=b;if(Object.create)a.prototype=Object.create(b.prototype,{constructor:{value:a}});else {var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a;}}};b.Util=e;var f=f||{getRGB:function(b){var c={};if(typeof b=="number")e=Math.floor(b),c.r=(b>>16&255)/255,c.g=(b>>8&255)/255,c.b=(b&255)/255;else if(typeof b=="string"){var d;if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(b))c.r=Math.min(255,parseInt(d[1],10))/255,c.g=Math.min(255,parseInt(d[2],10))/255,c.b=Math.min(255,parseInt(d[3],10))/255;else if(d=/^\#([A-Fa-f0-9]+)$/.exec(b)){var e=d[1];c.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,c.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,c.b=parseInt(e.charAt(4)+e.charAt(5),16)/255;}}else b instanceof a.Color&&(c.r=b.r,c.g=b.g,c.b=b.b);return c}};b.ColorUtil=f;var g={toScreenPos:function(){var b=new a.Vector3;return function(a,c,d){b.copy(a),b.project(c),b.x=Math.round((b.x+1)*d.width/2),b.y=Math.round((-b.y+1)*d.height/2),b.z=0;return b}}(),toSpacePos:function(){var b=new a.Vector3,c=new a.Vector3,d;return function(a,e,f){b.set(a.x/f.width*2-1,-(a.y/f.height)*2+1,.5),b.unproject(e),c.copy(b.sub(e.position).normalize()),d=-e.position.z/c.z,b.copy(e.position),b.add(c.multiplyScalar(d));return b}}(),getTexture:function(){var c={};return function(d){if(d instanceof a.Texture)return d;if(typeof d=="string"){var e=b.PUID.hash(d);c[e]||(c[e]=new a.Texture(d));return c[e]}if(d instanceof Image){var e=b.PUID.hash(d.src);c[e]||(c[e]=new a.Texture(d));return c[e]}}}()};b.THREEUtil=g;var h=h||{_id:0,_uids:{},id:function(a){for(var b in this._uids)if(this._uids[b]==a)return b;var c="PUID_"+this._id++;this._uids[c]=a;return c},hash:function(a){return}};b.PUID=h,i.ID=0,i.prototype={getDirection:function(){return Math.atan2(this.v.x,-this.v.y)*(180/b.PI)},reset:function(a){this.life=Infinity,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=b.ease.setEasingByName(b.ease.easeLinear),a?(this.p=new b.Vector3D,this.v=new b.Vector3D,this.a=new b.Vector3D,this.old={},this.old.p=this.p.clone(),this.old.v=this.v.clone(),this.old.a=this.a.clone(),this.behaviours=[],this.transform={},this.color={r:0,g:0,b:0},this.rotation=new b.Vector3D):(this.p.set(0,0,0),this.v.set(0,0,0),this.a.set(0,0,0),this.old.p.set(0,0,0),this.old.v.set(0,0,0),this.old.a.set(0,0,0),this.color.r=0,this.color.g=0,this.color.b=0,this.rotation.clear(),b.Util.destroyObject(this.transform),this.removeAllBehaviours());return this},update:function(a,b){if(!this.sleep){this.age+=a;var c=this.behaviours.length;while(c--)this.behaviours[c]&&this.behaviours[c].applyBehaviour(this,a,b);}if(this.age>=this.life)this.destroy();else {var d=this.easing(this.age/this.life);this.energy=Math.max(1-d,0);}},addBehaviour:function(a){this.behaviours.push(a),a.initialize(this);},addBehaviours:function(a){var b=a.length;while(b--)this.addBehaviour(a[b]);},removeBehaviour:function(a){var b=this.behaviours.indexOf(a);b>-1&&this.behaviours.splice(b,1);},removeAllBehaviours:function(){b.Util.destroyArray(this.behaviours);},destroy:function(){this.removeAllBehaviours(),this.energy=0,this.dead=!0,this.parent=null;}},b.Particle=i,j.prototype={create:function(a){this.cID++;return typeof a=="function"?new a:a.clone()},getCount:function(){var a=0;for(var b in this.list)a+=this.list[b].length;return a++},get:function(a){var c,d=a.__puid||b.PUID.id(a);this.list[d]&&this.list[d].length>0?c=this.list[d].pop():c=this.create(a),c.__puid=a.__puid||d;return c},expire:function(a){return this._getList(a.__puid).push(a)},destroy:function(){for(var a in this.list)this.list[a].length=0,delete this.list[a];},_getList:function(a){a=a||"default",this.list[a]||(this.list[a]=[]);return this.list[a]}},b.Pool=j;var k={randomAToB:function(a,b,c){return c?(Math.random()*(b-a)>>0)+a:a+Math.random()*(b-a)},randomFloating:function(a,b,c){return k.randomAToB(a-b,a+b,c)},randomZone:function(a){},degreeTransform:function(a){return a*b.PI/180},toColor16:function(a){return "#"+a.toString(16)},randomColor:function(){return "#"+("00000"+(Math.random()*16777216<<0).toString(16)).slice(-6)},lerp:function(a,b,c){return b+(a-b)*c},getNormal:function(a,b){a.x==0&&a.y==0?a.z==0?b.set(1,0,1):b.set(1,1,-a.y/a.z):a.x==0?b.set(1,0,1):b.set(-a.y/a.x,1,1);return b.normalize()},axisRotate:function(a,b,c,d){var e=Math.cos(d),f=Math.sin(d),g=c.dot(b)*(1-e);a.copy(c),a.cross(b).scalar(f),a.addValue(b.x*e,b.y*e,b.z*e),a.addValue(c.x*g,c.y*g,c.z*g);}};b.MathUtils=k;var m=function(a){this.type=b.Util.initValue(a,b.EULER);};m.prototype={integrate:function(a,b,c){this.euler(a,b,c);},euler:function(a,b,c){a.sleep||(a.old.p.copy(a.p),a.old.v.copy(a.v),a.a.scalar(1/a.mass),a.v.add(a.a.scalar(b)),a.p.add(a.old.v.scalar(b)),c&&a.v.scalar(c),a.a.clear());}},b.Integration=m;var n=function(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0;};n.prototype={set:function(a,b,c){this.x=a,this.y=b,this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},getGradient:function(){if(this.x!=0)return Math.atan2(this.y,this.x);if(this.y>0)return b.PI/2;if(this.y<0)return -b.PI/2},copy:function(a){this.x=a.x,this.y=a.y,this.z=a.z;return this},add:function(a,b){if(b!==undefined)return this.addVectors(a,b);this.x+=a.x,this.y+=a.y,this.z+=a.z;return this},addValue:function(a,b,c){this.x+=a,this.y+=b,this.z+=c;return this},addVectors:function(a,b){this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z;return this},addScalar:function(a){this.x+=a,this.y+=a,this.z+=a;return this},sub:function(a,b){if(b!==undefined)return this.subVectors(a,b);this.x-=a.x,this.y-=a.y,this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z;return this},scalar:function(a){this.x*=a,this.y*=a,this.z*=a;return this},divideScalar:function(a){a!==0?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.scalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},cross:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y,this.y=d*a.x-b*a.z,this.z=b*a.y-c*a.x;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f;return this},eulerFromDir:function(a){},applyEuler:function(){var a;return function(c){a===undefined&&(a=new b.Quaternion),this.applyQuaternion(a.setFromEuler(c));return this}}(),applyAxisAngle:function(){var a;return function(c,d){a===undefined&&(a=new b.Quaternion),this.applyQuaternion(a.setFromAxisAngle(c,d));return this}}(),applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,h=a.w,i=h*b+f*d-g*c,j=h*c+g*b-e*d,k=h*d+e*c-f*b,l=-e*b-f*c-g*d;this.x=i*h+l*-e+j*-g-k*-f,this.y=j*h+l*-f+k*-e-i*-g,this.z=k*h+l*-g+i*-f-j*-e;return this},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,d=this.z-a.z;return b*b+c*c+d*d},lerp:function(a,b){this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},clear:function(){this.x=0,this.y=0,this.z=0;return this},clone:function(){return new b.Vector3D(this.x,this.y,this.z)},toString:function(){return "x:"+this.x+"y:"+this.y+"z:"+this.z}},b.Vector3D=n;var o=function(a,b,c){this.radius=a||1,this.phi=c||0,this.theta=b||0;};o.prototype={set:function(a,b,c){this.radius=a||1,this.phi=c||0,this.theta=b||0;return this},setRadius:function(a){this.radius=a;return this},setPhi:function(a){this.phi=a;return this},setTheta:function(a){this.theta=a;return this},copy:function(a){this.radius=a.radius,this.phi=a.phi,this.theta=a.theta;return this},toVector3D:function(){return new b.Vector3D(this.getX(),this.getY(),this.getZ())},getX:function(){return this.radius*Math.sin(this.theta)*Math.cos(this.phi)},getY:function(){return -this.radius*Math.sin(this.theta)*Math.sin(this.phi)},getZ:function(){return this.radius*Math.cos(this.theta)},normalize:function(){this.radius=1;return this},equals:function(a){return a.radius===this.radius&&a.phi===this.phi&&a.theta===this.theta},clear:function(){this.radius=0,this.phi=0,this.theta=0;return this},clone:function(){return new o(this.radius,this.phi,this.theta)}},b.Polar3D=o,p.prototype={getValue:function(a){return this._isArray?this.a[this.a.length*Math.random()>>0]:this._center?b.MathUtils.randomFloating(this.a,this.b,a):b.MathUtils.randomAToB(this.a,this.b,a)}},b.createSpan=function(a,b,c){if(a instanceof p)return a;return b===undefined?new p(a):c===undefined?new p(a,b):new p(a,b,c)},b.Span=p,b.Util.inherits(q,b.Span),q.prototype.getValue=function(){var a=this._arr[this._arr.length*Math.random()>>0];return a=="random"||a=="Random"?b.MathUtils.randomColor():a},b.createArraySpan=function(a){if(!a)return null;return a instanceof b.ArraySpan?a:new b.ArraySpan(a)},b.ArraySpan=q;var r=function(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=d!==undefined?d:1;};r.prototype={set:function(a,b,c,d){this.x=a,this.y=b,this.z=c,this.w=d;return this},clone:function(){return new b.Quaternion(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w;return this},setFromEuler:function(a){var b=Math.cos(a.x/2),c=Math.cos(a.y/2),d=Math.cos(a.z/2),e=Math.sin(a.x/2),f=Math.sin(a.y/2),g=Math.sin(a.z/2);this.x=e*c*d+b*f*g,this.y=b*f*d-e*c*g,this.z=b*c*g+e*f*d,this.w=b*c*d-e*f*g;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d,this.y=a.y*d,this.z=a.z*d,this.w=Math.cos(c);return this},normalize:function(){var a=this.length();a===0?(this.x=0,this.y=0,this.z=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w}},b.Quaternion=r,s.prototype={contains:function(a,b,c){return a<=this.right&&a>=this.x&&b<=this.bottom&&b>=this.y&&c<=this.depth&&c>=this.z?!0:!1}},b.Box=s,t.id=0,t.prototype={reset:function(a,c){this.life=b.Util.initValue(a,Infinity),this.easing=b.Util.initValue(c,b.ease.setEasingByName(b.ease.easeLinear));},normalizeForce:function(a){return a.scalar(b.MEASURE)},normalizeValue:function(a){return a*b.MEASURE},initialize:function(a){},applyBehaviour:function(a,b,c){if(!this.dead){this.age+=b;if(this.age>=this.life){this.energy=0,this.dead=!0;return}var d=this.easing(a.age/a.life);this.energy=Math.max(1-d,0);}},destroy:function(){}},b.Behaviour=t,u.prototype={init:function(){this.startTime=0,this.nextTime=this.timePan.getValue();},getValue:function(a){this.startTime+=a;if(this.startTime>=this.nextTime){this.init();return this.numPan.b==1?this.numPan.getValue("Float")>.5?1:0:this.numPan.getValue("Int")}return 0}},b.Rate=u,v.prototype.reset=function(){},v.prototype.init=function(a,b){b?this.initialize(b):this.initialize(a);},v.prototype.initialize=function(a){},b.Initialize=v;var w={initialize:function(a,c,d){var e=d.length;while(e--){var f=d[e];f instanceof b.Initialize?f.init(a,c):w.init(a,c,f);}w.bindEmitter(a,c);},init:function(a,c,d){b.Util.setPrototypeByObj(c,d),b.Util.setVectorByObj(c,d);},bindEmitter:function(a,b){a.bindEmitter&&(b.p.add(a.p),b.v.add(a.v),b.a.add(a.a),b.v.applyEuler(a.rotation));}};b.InitializeUtil=w,b.Util.inherits(x,b.Initialize),x.prototype.initialize=function(a){this.lifePan.a==Infinity||this.lifePan.a=="infi"?a.life=Infinity:a.life=this.lifePan.getValue();},b.Life=x,b.Util.inherits(y,b.Initialize),y.prototype.reset=function(){this.zones?this.zones.length=0:this.zones=[];var a=Array.prototype.slice.call(arguments);this.zones=this.zones.concat(a);},y.prototype.addZone=function(){var a=Array.prototype.slice.call(arguments);this.zones=this.zones.concat(a);},y.prototype.initialize=function(){return function(a){var b=this.zones[Math.random()*this.zones.length>>0];b.getPosition(),a.p.x=b.vector.x,a.p.y=b.vector.y,a.p.z=b.vector.z;}}(),b.Position=y,b.P=y,b.Util.inherits(z,b.Initialize),z.prototype.reset=function(a,c,d){a instanceof b.Vector3D?(this.radiusPan=b.createSpan(1),this.dir=a.clone(),this.tha=c*b.DR,this._useV=!0):a instanceof b.Polar3D?(this.tha=c*b.DR,this.dirVec=a.toVector3D(),this._useV=!1):(this.radiusPan=b.createSpan(a),this.dir=c.clone().normalize(),this.tha=d*b.DR,this._useV=!0);},z.prototype.normalize=function(a){return a*b.MEASURE},z.prototype.initialize=function(){var a,c=new b.Vector3D(0,0,1),d=new b.Vector3D(0,0,0);return function(e){a=this.tha*Math.random(),this._useV&&this.dirVec.copy(this.dir).scalar(this.radiusPan.getValue()),b.MathUtils.getNormal(this.dirVec,c),d.copy(this.dirVec).applyAxisAngle(c,a),d.applyAxisAngle(this.dirVec.normalize(),Math.random()*b.PI*2),e.v.copy(d);return this}}(),b.Velocity=z,b.V=z,b.Util.inherits(A,b.Initialize),A.prototype.initialize=function(a){a.mass=this.massPan.getValue();},b.Mass=A,b.Util.inherits(B,b.Initialize),B.prototype.reset=function(a,c,d){this.radius=b.createSpan(a,c,d);},B.prototype.initialize=function(a){a.radius=this.radius.getValue(),a.transform.oldRadius=a.radius;},b.Radius=B,b.Util.inherits(C,b.Initialize),C.prototype.initialize=function(a){var b=this.body.getValue();this.w?a.body={width:this.w,height:this.h,body:b}:a.body=b;},b.Body=C,b.Util.inherits(D,b.Behaviour),D.prototype.reset=function(a,c,d){this.force=this.normalizeForce(new b.Vector3D(a,c,d)),this.force.id=Math.random();},D.prototype.applyBehaviour=function(a,b,c){D._super_.prototype.applyBehaviour.call(this,a,b,c),a.a.add(this.force);},b.F=b.Force=D,b.Util.inherits(E,b.Behaviour),E.prototype.reset=function(a,c,d,e,f){this.targetPosition=b.Util.initValue(a,new b.Vector3D),this.radius=b.Util.initValue(d,1e3),this.force=b.Util.initValue(this.normalizeValue(c),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new b.Vector3D,this.lengthSq=0,e&&E._super_.prototype.reset.call(this,e,f);},E.prototype.applyBehaviour=function(a,b,c){E._super_.prototype.applyBehaviour.call(this,a,b,c),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(a.p),this.lengthSq=this.attractionForce.lengthSq(),this.lengthSq>4e-6&&this.lengthSq<this.radiusSq&&(this.attractionForce.normalize(),this.attractionForce.scalar(1-this.lengthSq/this.radiusSq),this.attractionForce.scalar(this.force),a.a.add(this.attractionForce));},b.Attraction=E,b.Util.inherits(F,b.Behaviour),F.prototype.reset=function(a,c,d,e,f,g){this.randomFoce=this.normalizeForce(new b.Vector3D(a,c,d)),this.delayPan=b.createSpan(e||.03),this.time=0,f&&F._super_.prototype.reset.call(this,f,g);},F.prototype.applyBehaviour=function(a,c,d){F._super_.prototype.applyBehaviour.call(this,a,c,d),this.time+=c;if(this.time>=this.delayPan.getValue()){var e=b.MathUtils.randomAToB(-this.randomFoce.x,this.randomFoce.x),f=b.MathUtils.randomAToB(-this.randomFoce.y,this.randomFoce.y),g=b.MathUtils.randomAToB(-this.randomFoce.z,this.randomFoce.z);a.a.addValue(e,f,g),this.time=0;}},b.RandomDrift=F,b.Util.inherits(G,b.Attraction),G.prototype.reset=function(a,b,c,d,e){G._super_.prototype.reset.call(this,a,b,c,d,e),this.force*=-1;},b.Repulsion=G,b.Util.inherits(H,b.Force),H.prototype.reset=function(a,b,c){H._super_.prototype.reset.call(this,0,-a,0,b,c);},b.Gravity=H,b.G=H,b.Util.inherits(I,b.Behaviour),I.prototype.reset=function(a,c,d,e,f){this.emitter=a,this.useMass=c,this.callback=d,this.particles=[],this.delta=new b.Vector3D,e&&I._super_.prototype.reset.call(this,e,f);},I.prototype.applyBehaviour=function(a,b,c){var d=this.emitter?this.emitter.particles.slice(c):this.particles.slice(c),e,f,g,h,i,j,k=d.length;while(k--){e=d[k];if(e==a)continue;this.delta.copy(e.p).sub(a.p),f=this.delta.lengthSq(),h=a.radius+e.radius,f<=h*h&&(g=h-Math.sqrt(f),g+=.5,i=this._getAverageMass(a,e),j=this._getAverageMass(e,a),a.p.add(this.delta.clone().normalize().scalar(g*-i)),e.p.add(this.delta.normalize().scalar(g*j)),this.callback&&this.callback(a,e));}},I.prototype._getAverageMass=function(a,b){return this.useMass?b.mass/(a.mass+b.mass):.5},b.Collision=I,b.Util.inherits(J,b.Behaviour),J.prototype.reset=function(a,c,d,e){var f,g;typeof a=="string"?(g=a,f=c):(g=c,f=a),this.zone=f,this.zone.crossType=b.Util.initValue(g,"dead"),d&&J._super_.prototype.reset.call(this,d,e);},J.prototype.applyBehaviour=function(a,b,c){J._super_.prototype.applyBehaviour.call(this,a,b,c),this.zone.crossing.call(this.zone,a);},b.CrossZone=J,b.Util.inherits(K,b.Behaviour),K.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createSpan(b.Util.initValue(a,1)),this.b=b.createSpan(c),d&&K._super_.prototype.reset.call(this,d,e);},K.prototype.initialize=function(a){a.useAlpha=!0,a.transform.alphaA=this.a.getValue(),this._same?a.transform.alphaB=a.transform.alphaA:a.transform.alphaB=this.b.getValue();},K.prototype.applyBehaviour=function(a,c,d){K._super_.prototype.applyBehaviour.call(this,a,c,d),a.alpha=b.MathUtils.lerp(a.transform.alphaA,a.transform.alphaB,this.energy),a.alpha<.002&&(a.alpha=0);},b.Alpha=K,b.Util.inherits(L,b.Behaviour),L.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createSpan(b.Util.initValue(a,1)),this.b=b.createSpan(c),d&&L._super_.prototype.reset.call(this,d,e);},L.prototype.initialize=function(a){a.transform.scaleA=this.a.getValue(),a.transform.oldRadius=a.radius,this._same?a.transform.scaleB=a.transform.scaleA:a.transform.scaleB=this.b.getValue();},L.prototype.applyBehaviour=function(a,c,d){L._super_.prototype.applyBehaviour.call(this,a,c,d),a.scale=b.MathUtils.lerp(a.transform.scaleA,a.transform.scaleB,this.energy),a.scale<5e-4&&(a.scale=0),a.radius=a.transform.oldRadius*a.scale;},b.Scale=L,b.Util.inherits(M,b.Behaviour),M.prototype.reset=function(a,c,d,e,f){this.a=a||0,this.b=c||0,this.c=d||0,a===undefined||a=="same"?this._type="same":c==undefined?this._type="set":d===undefined?this._type="to":(this._type="add",this.a=b.createSpan(this.a*b.DR),this.b=b.createSpan(this.b*b.DR),this.c=b.createSpan(this.c*b.DR)),e&&M._super_.prototype.reset.call(this,e,f);},M.prototype.initialize=function(a){switch(this._type){case"same":break;case"set":this._setRotation(a.rotation,this.a);break;case"to":a.transform.fR=a.transform.fR||new b.Vector3D,a.transform.tR=a.transform.tR||new b.Vector3D,this._setRotation(a.transform.fR,this.a),this._setRotation(a.transform.tR,this.b);break;case"add":a.transform.addR=new b.Vector3D(this.a.getValue(),this.b.getValue(),this.c.getValue());}},M.prototype._setRotation=function(a,c){a=a||new b.Vector3D;if(c=="random"){var d=b.MathUtils.randomAToB(-b.PI,b.PI),e=b.MathUtils.randomAToB(-b.PI,b.PI),f=b.MathUtils.randomAToB(-b.PI,b.PI);a.set(d,e,f);}else c instanceof b.Vector3D&&a.copy(c);},M.prototype.applyBehaviour=function(a,c,d){M._super_.prototype.applyBehaviour.call(this,a,c,d);switch(this._type){case"same":a.rotation||(a.rotation=new b.Vector3D),a.rotation.eulerFromDir(a.v);break;case"set":break;case"to":a.rotation.x=b.MathUtils.lerp(a.transform.fR.x,a.transform.tR.x,this.energy),a.rotation.y=b.MathUtils.lerp(a.transform.fR.y,a.transform.tR.y,this.energy),a.rotation.z=b.MathUtils.lerp(a.transform.fR.z,a.transform.tR.z,this.energy);break;case"add":a.rotation.add(a.transform.addR);}},b.Rotate=M,b.Util.inherits(N,b.Behaviour),N.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createArraySpan(a),this.b=b.createArraySpan(c),d&&N._super_.prototype.reset.call(this,d,e);},N.prototype.initialize=function(a){a.transform.colorA=b.ColorUtil.getRGB(this.a.getValue()),a.useColor=!0,this._same?a.transform.colorB=a.transform.colorA:a.transform.colorB=b.ColorUtil.getRGB(this.b.getValue());},N.prototype.applyBehaviour=function(a,c,d){N._super_.prototype.applyBehaviour.call(this,a,c,d),this._same?(a.color.r=a.transform.colorA.r,a.color.g=a.transform.colorA.g,a.color.b=a.transform.colorA.b):(a.color.r=b.MathUtils.lerp(a.transform.colorA.r,a.transform.colorB.r,this.energy),a.color.g=b.MathUtils.lerp(a.transform.colorA.g,a.transform.colorB.g,this.energy),a.color.b=b.MathUtils.lerp(a.transform.colorA.b,a.transform.colorB.b,this.energy));},b.Color=N,b.Util.inherits(O,b.Behaviour),O.prototype.reset=function(a,c,d,e,f){this.pos?this.pos.set(a,c,d):this.pos=new b.Vector3D(a,c,d),this.spring=e||.1,this.friction=f||.98;},O.prototype.applyBehaviour=function(a,b,c){O._super_.prototype.applyBehaviour.call(this,a,b,c),a.v.x+=(this.pos.x-a.p.x)*this.spring,a.v.y+=(this.pos.y-a.p.y)*this.spring,a.v.z+=(this.pos.z-a.p.z)*this.spring;},b.Spring=O,P.ID=0,b.Util.inherits(P,b.Particle),b.EventDispatcher.initialize(P.prototype),P.prototype.emit=function(a,c){this.currentEmitTime=0,this.totalEmitTimes=b.Util.initValue(a,Infinity),c==!0||c=="life"||c=="destroy"?this.life=a=="once"?1:this.totalEmitTimes:isNaN(c)||(this.life=c),this.rate.init();},P.prototype.stopEmit=function(){this.totalEmitTimes=-1,this.currentEmitTime=0;},P.prototype.removeAllParticles=function(){var a=this.particles.length;while(a--)this.particles[a].dead=!0;},P.prototype.createParticle=function(a,c){var d=this.parent.pool.get(b.Particle);this.setupParticle(d,a,c),this.parent&&this.parent.dispatchEvent("PARTICLE_CREATED",d),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_CREATED",d);return d},P.prototype.addSelfInitialize=function(a){a.init?a.init(this):this.initAll();},P.prototype.addInitialize=function(){var a=arguments.length;while(a--)this.initializes.push(arguments[a]);},P.prototype.removeInitialize=function(a){var b=this.initializes.indexOf(a);b>-1&&this.initializes.splice(b,1);},P.prototype.removeInitializers=function(){b.Util.destroyArray(this.initializes);},P.prototype.addBehaviour=function(){var a=arguments.length;while(a--)this.behaviours.push(arguments[a]);},P.prototype.removeBehaviour=function(a){var b=this.behaviours.indexOf(a);b>-1&&this.behaviours.splice(b,1);},P.prototype.removeAllBehaviours=function(){b.Util.destroyArray(this.behaviours);},P.prototype.integrate=function(a){var c=1-this.damping;b.integrator.integrate(this,a,c);var d=this.particles.length;while(d--){var e=this.particles[d];e.update(a,d),b.integrator.integrate(e,a,c),this.parent&&this.parent.dispatchEvent("PARTICLE_UPDATE",e),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_UPDATE",e);}},P.prototype.emitting=function(a){if(this.totalEmitTimes=="once"){var b=this.rate.getValue(99999);b>0&&(this.cID=b);while(b--)this.createParticle();this.totalEmitTimes="none";}else if(!isNaN(this.totalEmitTimes)){this.currentEmitTime+=a;if(this.currentEmitTime<this.totalEmitTimes){var b=this.rate.getValue(a);b>0&&(this.cID=b);while(b--)this.createParticle();}}},P.prototype.update=function(a){this.age+=a,(this.dead||this.age>=this.life)&&this.destroy(),this.emitting(a),this.integrate(a);var c,d=this.particles.length;while(d--)c=this.particles[d],c.dead&&(this.parent&&this.parent.dispatchEvent("PARTICLE_DEAD",c),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_DEAD",c),this.parent.pool.expire(c.reset()),this.particles.splice(d,1));},P.prototype.setupParticle=function(a,c,d){var e=this.initializes,f=this.behaviours;c&&(b.Util.isArray(c)?e=c:e=[c]),d&&(b.Util.isArray(d)?f=d:f=[d]),b.InitializeUtil.initialize(this,a,e),a.addBehaviours(f),a.parent=this,this.particles.push(a);},P.prototype.destroy=function(){this.dead=!0,this.energy=0,this.totalEmitTimes=-1,this.particles.length==0&&(this.removeInitializers(),this.removeAllBehaviours(),this.parent&&this.parent.removeEmitter(this));},b.Emitter=P,b.Util.inherits(Q,b.Emitter),Q.prototype.addSelfBehaviour=function(){var a=arguments.length,b;for(b=0;b<a;b++)this.selfBehaviours.push(arguments[b]);},Q.prototype.removeSelfBehaviour=function(a){var b=this.selfBehaviours.indexOf(a);b>-1&&this.selfBehaviours.splice(b,1);},Q.prototype.update=function(a){Q._super_.prototype.update.call(this,a);if(!this.sleep){var b=this.selfBehaviours.length,c;for(c=0;c<b;c++)this.selfBehaviours[c].applyBehaviour(this,a,c);}},b.BehaviourEmitter=Q,b.Util.inherits(R,b.Emitter),R.prototype.initEventHandler=function(){var a=this;this.mousemoveHandler=function(b){a.mousemove.call(a,b);},this.mousedownHandler=function(b){a.mousedown.call(a,b);},this.mouseupHandler=function(b){a.mouseup.call(a,b);},this.mouseTarget.addEventListener("mousemove",this.mousemoveHandler,!1);},R.prototype.emit=function(){this._allowEmitting=!0;},R.prototype.stopEmit=function(){this._allowEmitting=!1;},R.prototype.setCameraAndCanvas=function(a,b){this.camera=a,this.canvas=b;},R.prototype.setCameraAndRenderer=function(a,b){this.camera=a,this.renderer=b,this.canvas=b.domElement;},R.prototype.mousemove=function(a){var c=this.canvas.getBoundingClientRect(),d=a.clientX-c.left,e=a.clientY-c.top,f=this.renderer?this.renderer.getPixelRatio():1;d*=f,e*=f,this.mouse.x+=(d-this.mouse.x)*this.ease,this.mouse.y+=(e-this.mouse.y)*this.ease,this.p.copy(b.THREEUtil.toSpacePos(this.mouse,this.camera,this.canvas,this.renderer)),this._allowEmitting&&R._super_.prototype.emit.call(this,"once");},R.prototype.destroy=function(){R._super_.prototype.destroy.call(this),this.mouseTarget.removeEventListener("mousemove",this.mousemoveHandler,!1);},b.FollowEmitter=R;var S=S||{easeLinear:function(a){return a},easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return -(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){if((a/=.5)<1)return .5*Math.pow(a,2);return -0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){if((a/=.5)<1)return .5*Math.pow(a,3);return .5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return -(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){if((a/=.5)<1)return .5*Math.pow(a,4);return -0.5*((a-=2)*Math.pow(a,3)-2)},easeInSine:function(a){return -Math.cos(a*(b.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(b.PI/2))},easeInOutSine:function(a){return -0.5*(Math.cos(b.PI*a)-1)},easeInExpo:function(a){return a===0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a===1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){if(a===0)return 0;if(a===1)return 1;if((a/=.5)<1)return .5*Math.pow(2,10*(a-1));return .5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return -(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){if((a/=.5)<1)return -0.5*(Math.sqrt(1-a*a)-1);return .5*(Math.sqrt(1-(a-=2)*a)+1)},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return (a=a-1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;if((a/=.5)<1)return .5*a*a*(((b*=1.525)+1)*a-b);return .5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},setEasingByName:function(a){return S[a]?S[a]:S.easeLinear}};for(var T in S)T!="setEasingByName"&&(b[T]=S[T]);b.ease=S,U.prototype={init:function(a){var b=this;this.proton=a,this.proton.addEventListener("PROTON_UPDATE",function(a){b.onProtonUpdate.call(b,a);}),this.proton.addEventListener("PARTICLE_CREATED",function(a){b.onParticleCreated.call(b,a);}),this.proton.addEventListener("PARTICLE_UPDATE",function(a){b.onParticleUpdate.call(b,a);}),this.proton.addEventListener("PARTICLE_DEAD",function(a){b.onParticleDead.call(b,a);});},remove:function(a){this.proton=null;},onParticleCreated:function(a){},onParticleUpdate:function(a){},onParticleDead:function(a){},onProtonUpdate:function(a){}},b.BaseRender=U,b.Util.inherits(V,b.BaseRender),V.prototype.onProtonUpdate=function(){},V.prototype.onParticleCreated=function(a){if(!a.target){a.body||(a.body=this._body),a.target=this._targetPool.get(a.body);if(a.useAlpha||a.useColor)a.target.material.__puid=b.PUID.id(a.body.material),a.target.material=this._materialPool.get(a.target.material);}a.target&&(a.target.position.copy(a.p),this.container.add(a.target));},V.prototype.onParticleUpdate=function(a){a.target&&(a.target.position.copy(a.p),a.target.rotation.set(a.rotation.x,a.rotation.y,a.rotation.z),this.scale(a),a.useAlpha&&(a.target.material.opacity=a.alpha,a.target.material.transparent=!0),a.useColor&&a.target.material.color.copy(a.color));},V.prototype.scale=function(a){a.target.scale.set(a.scale,a.scale,a.scale);},V.prototype.onParticleDead=function(a){a.target&&((a.useAlpha||a.useColor)&&this._materialPool.expire(a.target.material),this._targetPool.expire(a.target),this.container.remove(a.target),a.target=null);},b.MeshRender=V,b.Util.inherits(W,b.BaseRender),W.prototype.onProtonUpdate=function(){},W.prototype.onParticleCreated=function(b){b.target||(b.target=new a.Vector3),b.target.copy(b.p),this.points.geometry.vertices.push(b.target);},W.prototype.onParticleUpdate=function(a){a.target&&a.target.copy(a.p);},W.prototype.onParticleDead=function(a){if(a.target){var b=this.points.geometry.vertices.indexOf(a.target);b>-1&&this.points.geometry.vertices.splice(b,1),a.target=null;}},b.PointsRender=W,b.Util.inherits(X,b.MeshRender),X.prototype.scale=function(a){a.target.scale.set(a.scale*a.radius,a.scale*a.radius,1);},b.SpriteRender=X,b.Util.inherits(Y,b.BaseRender),Y.prototype.onProtonUpdate=function(){},Y.prototype.onParticleCreated=function(a){},Y.prototype.onParticleUpdate=function(a){},Y.prototype.onParticleDead=function(a){},b.CustomRender=Y,Z.prototype={getPosition:function(){return null},crossing:function(a){switch(this.crossType){case"bound":this._bound(a);break;case"cross":this._cross(a);break;case"dead":this._dead(a);}},_dead:function(a){},_bound:function(a){},_cross:function(a){}},b.Zone=Z,b.Util.inherits($,b.Zone),$.prototype.getPosition=function(){this.random=Math.random(),this.vector.x=this.x1+this.random*(this.x2-this.x1),this.vector.y=this.y1+this.random*(this.y2-this.y1),this.vector.z=this.z1+this.random*(this.z2-this.z1);return this.vector},$.prototype.crossing=function(a){this.log&&(console.error("Sorry LineZone does not support crossing method"),this.log=!1);},b.LineZone=$,b.Util.inherits(_,b.Zone),_.prototype.getPosition=function(){var a,c,d;return function(){this.random=Math.random(),d=this.random*this.radius,a=b.PI*Math.random(),c=b.PI*2*Math.random(),this.vector.x=this.x+d*Math.sin(a)*Math.cos(c),this.vector.y=this.y+d*Math.sin(c)*Math.sin(a),this.vector.z=this.z+d*Math.cos(a);return this.vector}}(),_.prototype._dead=function(a){var b=a.p.distanceTo(this);b-a.radius>this.radius&&(a.dead=!0);},_.prototype._bound=function(){var a=new b.Vector3D,c=new b.Vector3D,d;return function(b){var e=b.p.distanceTo(this);e+b.radius>=this.radius&&(a.copy(b.p).sub(this).normalize(),c.copy(b.v),d=2*c.dot(a),b.v.sub(a.scalar(d)));}}(),_.prototype._cross=function(a){this.log&&(console.error("Sorry SphereZone does not support _cross method"),this.log=!1);},b.SphereZone=_,b.Util.inherits(ba,b.Zone),ba.prototype.getPosition=function(){var a=this.geometry.vertices,b=a[a.length*Math.random()>>0];this.vector.x=b.x*this.scale,this.vector.y=b.y*this.scale,this.vector.z=b.z*this.scale;return this.vector},ba.prototype.crossing=function(a){this.log&&(console.error("Sorry MeshZone does not support crossing method"),this.log=!1);},b.MeshZone=ba,b.Util.inherits(bb,b.Zone),bb.prototype.getPosition=function(){this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z;return this.vector},bb.prototype.crossing=function(a){this.log&&(console.error("Sorry PointZone does not support crossing method"),this.log=!1);},b.PointZone=bb,b.Util.inherits(bc,b.Zone),bc.prototype.getPosition=function(){this.vector.x=this.x+b.MathUtils.randomAToB(-0.5,.5)*this.width,this.vector.y=this.y+b.MathUtils.randomAToB(-0.5,.5)*this.height,this.vector.z=this.z+b.MathUtils.randomAToB(-0.5,.5)*this.depth;return this.vector},bc.prototype._dead=function(a){a.p.x+a.radius<this.x-this.width/2?a.dead=!0:a.p.x-a.radius>this.x+this.width/2&&(a.dead=!0),a.p.y+a.radius<this.y-this.height/2?a.dead=!0:a.p.y-a.radius>this.y+this.height/2&&(a.dead=!0),a.p.z+a.radius<this.z-this.depth/2?a.dead=!0:a.p.z-a.radius>this.z+this.depth/2&&(a.dead=!0);},bc.prototype._bound=function(a){a.p.x-a.radius<this.x-this.width/2?(a.p.x=this.x-this.width/2+a.radius,a.v.x*=-this.friction,this._static(a,"x")):a.p.x+a.radius>this.x+this.width/2&&(a.p.x=this.x+this.width/2-a.radius,a.v.x*=-this.friction,this._static(a,"x")),a.p.y-a.radius<this.y-this.height/2?(a.p.y=this.y-this.height/2+a.radius,a.v.y*=-this.friction,this._static(a,"y")):a.p.y+a.radius>this.y+this.height/2&&(a.p.y=this.y+this.height/2-a.radius,a.v.y*=-this.friction,this._static(a,"y")),a.p.z-a.radius<this.z-this.depth/2?(a.p.z=this.z-this.depth/2+a.radius,a.v.z*=-this.friction,this._static(a,"z")):a.p.z+a.radius>this.z+this.depth/2&&(a.p.z=this.z+this.depth/2-a.radius,a.v.z*=-this.friction,this._static(a,"z"));},bc.prototype._static=function(a,b){a.v[b]*a.a[b]>0||Math.abs(a.v[b])<Math.abs(a.a[b])*.0167*this.max&&(a.v[b]=0,a.a[b]=0);},bc.prototype._cross=function(a){a.p.x+a.radius<this.x-this.width/2&&a.v.x<=0?a.p.x=this.x+this.width/2+a.radius:a.p.x-a.radius>this.x+this.width/2&&a.v.x>=0&&(a.p.x=this.x-this.width/2-a.radius),a.p.y+a.radius<this.y-this.height/2&&a.v.y<=0?a.p.y=this.y+this.height/2+a.radius:a.p.y-a.radius>this.y+this.height/2&&a.v.y>=0&&(a.p.y=this.y-this.height/2-a.radius),a.p.z+a.radius<this.z-this.depth/2&&a.v.z<=0?a.p.z=this.z+this.depth/2+a.radius:a.p.z-a.radius>this.z+this.depth/2&&a.v.z>=0&&(a.p.z=this.z-this.depth/2-a.radius);},b.BoxZone=bc,b.Util.inherits(bd,b.Zone),bd.prototype.getPosition=function(){var a=new b.Vector3D,c;return function(){c=this.renderer.domElement,a.x=Math.random()*c.width,a.y=Math.random()*c.height,this.vector.copy(b.THREEUtil.toSpacePos(a,this.camera,c));return this.vector}}(),bd.prototype._dead=function(a){var c=b.THREEUtil.toScreenPos(a.p,this.camera,this.renderer.domElement),d=this.renderer.domElement;c.y+a.radius<-this.dis&&this.d1?a.dead=!0:c.y-a.radius>d.height+this.dis&&this.d3&&(a.dead=!0),c.x+a.radius<-this.dis&&this.d4?a.dead=!0:c.x-a.radius>d.width+this.dis&&this.d2&&(a.dead=!0);},bd.prototype._cross=function(){var a=new b.Vector3D;return function(c){var d=b.THREEUtil.toScreenPos(c.p,this.camera,this.renderer.domElement),e=this.renderer.domElement;d.y+c.radius<-this.dis?(a.x=d.x,a.y=e.height+this.dis+c.radius,c.p.y=b.THREEUtil.toSpacePos(a,this.camera,e).y):d.y-c.radius>e.height+this.dis&&(a.x=d.x,a.y=-this.dis-c.radius,c.p.y=b.THREEUtil.toSpacePos(a,this.camera,e).y),d.x+c.radius<-this.dis?(a.y=d.y,a.x=e.width+this.dis+c.radius,c.p.x=b.THREEUtil.toSpacePos(a,this.camera,e).x):d.x-c.radius>e.width+this.dis&&(a.y=d.y,a.x=-this.dis-c.radius,c.p.x=b.THREEUtil.toSpacePos(a,this.camera,e).x);}}(),bd.prototype._bound=function(a){var c=b.THREEUtil.toScreenPos(a.p,this.camera,this.renderer.domElement),d=this.renderer.domElement;c.y+a.radius<-this.dis?a.v.y*=-1:c.y-a.radius>d.height+this.dis&&(a.v.y*=-1),c.x+a.radius<-this.dis?a.v.y*=-1:c.x-a.radius>d.width+this.dis&&(a.v.y*=-1);},b.ScreenZone=bd;var be=function(){if(window.console&&window.console.trace){var a=Array.prototype.slice.call(arguments),b=arguments[0]+"";if(b.indexOf("+")==0){var c=parseInt(arguments[0]);be.once<c&&(a.shift(),console.trace.apply(console,a),be.once++);}else a.unshift("+15"),be.apply(console,a);}};be.once=0,b.log=be;var bf=bf||{addEventListener:function(a,b){a.addEventListener("PROTON_UPDATE",function(a){b(a);});},drawZone:function(c,d,e){var f,g,h;e instanceof b.PointZone?f=new a.SphereGeometry(15):e instanceof b.LineZone||(e instanceof b.BoxZone?f=new a.BoxGeometry(e.width,e.height,e.depth):e instanceof b.SphereZone?f=new a.SphereGeometry(e.radius,10,10):e instanceof b.MeshZone&&(e.geometry instanceof a.Geometry?f=e.geometry:f=e.geometry.geometry,f=new a.SphereGeometry(e.radius,10,10))),g=new a.MeshBasicMaterial({color:"#2194ce",wireframe:!0}),h=new a.Mesh(f,g),d.add(h),this.addEventListener(c,function(a){h.position.set(e.x,e.y,e.z);});},drawEmitter:function(b,c,d,e){var f=new a.OctahedronGeometry(15),g=new a.MeshBasicMaterial({color:e||"#aaa",wireframe:!0}),h=new a.Mesh(f,g);c.add(h),this.addEventListener(b,function(){h.position.copy(d.p),h.rotation.set(d.rotation.x,d.rotation.y,d.rotation.z);});},renderInfo:function(){function b(a){var b=a.emitters[0];return Math.round(b.p.x)+","+Math.round(b.p.y)+","+Math.round(b.p.z)}function a(a,b){var c=b=="material"?"_materialPool":"_targetPool",d=a.renderers[0];return d[c].cID}return function(c,d){this.addInfo(d);var e="";switch(this._infoType){case 2:e+="emitter:"+c.emitters.length+"<br>",e+="em speed:"+c.emitters[0].cID+"<br>",e+="pos:"+b(c);break;case 3:e+=c.renderers[0].name+"<br>",e+="target:"+a(c,"target")+"<br>",e+="material:"+a(c,"material");break;default:e+="particles:"+c.getCount()+"<br>",e+="pool:"+c.pool.getCount()+"<br>",e+="total:"+(c.getCount()+c.pool.getCount());}this._infoCon.innerHTML=e;}}(),addInfo:function(){return function(a){var b=this;if(!this._infoCon){this._infoCon=document.createElement("div"),this._infoCon.style.cssText=["position:fixed;bottom:0px;left:0;cursor:pointer;","opacity:0.9;z-index:10000;padding:10px;font-size:12px;","width:120px;height:50px;background-color:#002;color:#0ff;"].join(""),this._infoType=1,this._infoCon.addEventListener("click",function(a){b._infoType++,b._infoType>3&&(b._infoType=1);},!1);var c,d;switch(a){case 2:c="#201",d="#f08";break;case 3:c="#020",d="#0f0";break;default:c="#002",d="#0ff";}this._infoCon.style["background-color"]=c,this._infoCon.style.color=d;}this._infoCon.parentNode||document.body.appendChild(this._infoCon);}}()};b.Debug=bf;return b});
87417
- }(three_proton_min));
87418
-
87419
- var Proton = three_proton_min.exports;let ParticleEmitterGroup = /*#__PURE__*/function (_Entity) {
87420
- _inherits(ParticleEmitterGroup, _Entity);
87421
-
87422
- var _super = _createSuper(ParticleEmitterGroup);
87423
-
87424
- function ParticleEmitterGroup() {
87425
- var _this;
87426
-
87427
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87428
-
87429
- _classCallCheck(this, ParticleEmitterGroup);
87430
-
87431
- _this = _super.call(this, {
87432
- tag: "particle "
87433
- });
87434
- const {
87435
- name = generateRandomName("EmitterGroup"),
87436
- system
87437
- } = options;
87438
- _this.options = { ...options,
87439
- name
87440
- };
87441
- _this.system = new Map();
87442
-
87443
- _this.setBody({
87444
- body: new Object3D()
87445
- });
87446
-
87447
- _this.setName(name);
87448
-
87449
- _this.setEntityType(ENTITY_TYPES.PARTICLE.TYPE);
87450
-
87451
- _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER_GROUP);
87452
87363
 
87453
- _this.setSystem(system);
87454
-
87455
- return _this;
87456
- }
87457
-
87458
- _createClass(ParticleEmitterGroup, [{
87459
- key: "setBody",
87460
- value: function setBody(_ref) {
87461
- let {
87462
- body
87463
- } = _ref;
87464
- this.body = body;
87465
-
87466
- if (this.hasBody()) {
87467
- this.addToScene();
87468
- }
87364
+ return false;
87469
87365
  }
87470
87366
  }, {
87471
- key: "addToScene",
87472
- value: function addToScene() {
87473
- const {
87474
- addUniverse = true
87475
- } = this.options;
87476
-
87477
- if (this.hasBody()) {
87478
- Scene$1.add(this.getBody(), this, addUniverse);
87479
- } else {
87480
- console.warn(ELEMENT_NOT_SET);
87481
- }
87367
+ key: "addHelpers",
87368
+ value: function addHelpers() {
87369
+ let {
87370
+ holderName = "particleholder",
87371
+ holderSize = 0.15
87372
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87373
+ this.addHolder(holderName, holderSize);
87374
+ this.isUsingHelper = true;
87482
87375
  }
87483
87376
  }, {
87484
- key: "isProtonEmitter",
87485
- value: function isProtonEmitter() {
87486
- this.system.forEach(emitter => emitter.isProtonEmitter());
87377
+ key: "usingHelper",
87378
+ value: function usingHelper() {
87379
+ return !!this.isUsingHelper;
87487
87380
  }
87488
87381
  }, {
87489
- key: "getType",
87490
- value: function getType() {
87491
- return PARTICLE_EMITTER_TYPES.GROUP;
87382
+ key: "hasHolder",
87383
+ value: function hasHolder() {
87384
+ return !!this.holder;
87492
87385
  }
87493
87386
  }, {
87494
- key: "hasSystem",
87495
- value: function hasSystem() {
87496
- return !!this.system && !!this.system.size > 0;
87387
+ key: "setPreset",
87388
+ value: function setPreset(preset) {
87389
+ this.preset = preset;
87497
87390
  }
87498
87391
  }, {
87499
- key: "isSystemDead",
87500
- value: function isSystemDead() {
87501
- this.system.forEach(emitter => emitter.isSystemDead());
87392
+ key: "getPreset",
87393
+ value: function getPreset() {
87394
+ return this.preset;
87502
87395
  }
87503
87396
  }, {
87504
- key: "setSystem",
87505
- value: function setSystem() {
87506
- let system = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
87507
- system.forEach(emitter => {
87508
- this.add(emitter);
87509
- this.system.set(emitter.getName(), emitter);
87510
- });
87397
+ key: "setSceneEmitter",
87398
+ value: function setSceneEmitter(value) {
87399
+ this._sceneEmitter = !!value;
87511
87400
  }
87512
87401
  }, {
87513
- key: "getSystem",
87514
- value: function getSystem() {
87515
- return this.system;
87402
+ key: "isSceneEmitter",
87403
+ value: function isSceneEmitter() {
87404
+ return this._sceneEmitter;
87516
87405
  }
87517
87406
  }, {
87518
- key: "getEmitter",
87519
- value: function getEmitter(name) {
87520
- const emitter = this.system.get(name);
87407
+ key: "toJSON",
87408
+ value: function toJSON() {
87409
+ let parseJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
87521
87410
 
87522
- if (emitter) {
87523
- return emitter;
87524
- } else {
87525
- console.log(EMITTER_NOT_FOUND, name);
87526
- }
87527
- }
87528
- }, {
87529
- key: "forEach",
87530
- value: function forEach(cb) {
87531
- this.system.forEach(emitter => cb(emitter));
87532
- }
87533
- }, {
87534
- key: "emit",
87535
- value: function emit() {
87536
- for (var _len = arguments.length, options = new Array(_len), _key = 0; _key < _len; _key++) {
87537
- options[_key] = arguments[_key];
87538
- }
87411
+ const base = _get(_getPrototypeOf(ParticleEmitter.prototype), "toJSON", this).call(this, parseJSON);
87539
87412
 
87540
- if (this.hasSystem()) {
87541
- this.system.forEach(emitter => emitter.emit(...options));
87542
- }
87543
- }
87544
- }, {
87545
- key: "stop",
87546
- value: function stop() {
87547
- if (this.hasSystem()) {
87548
- this.system.forEach(emitter => emitter.stop());
87549
- }
87413
+ if (!base) return base; // Replace `options` with the serializable particleConfig
87414
+ // so that Proton objects (Rate, Initializers, Behaviours) don't end up in JSON
87415
+
87416
+ return { ...base,
87417
+ preset: this.preset,
87418
+ options: this.particleConfig
87419
+ };
87550
87420
  }
87551
87421
  }, {
87552
87422
  key: "dispose",
87553
87423
  value: function dispose() {
87554
- _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "dispose", this).call(this);
87424
+ _get(_getPrototypeOf(ParticleEmitter.prototype), "dispose", this).call(this);
87425
+ }
87426
+ }, {
87427
+ key: "setPosition",
87428
+ value: function setPosition(where) {
87429
+ let {
87430
+ updateHolder = true
87431
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87555
87432
 
87556
- this.system.forEach(emitter => emitter.dispose());
87433
+ _get(_getPrototypeOf(ParticleEmitter.prototype), "setPosition", this).call(this, where);
87434
+
87435
+ if (this.hasHolder() && updateHolder) {
87436
+ this.holder.setPosition(this.getPosition());
87437
+ }
87557
87438
  }
87558
87439
  }, {
87559
87440
  key: "update",
87560
87441
  value: function update(dt) {
87561
- _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "update", this).call(this, dt);
87442
+ _get(_getPrototypeOf(ParticleEmitter.prototype), "update", this).call(this, dt);
87562
87443
 
87563
- if (this.hasSystem()) {
87564
- this.system.forEach(emitter => emitter.update(dt));
87444
+ this.syncParticleEmitter();
87445
+
87446
+ if (this.usingHelper()) {
87447
+ this.setPosition(this.holder.getPosition(), {
87448
+ updateHolder: false
87449
+ });
87565
87450
  }
87566
87451
  }
87567
87452
  }]);
87568
87453
 
87569
- return ParticleEmitterGroup;
87454
+ return ParticleEmitter;
87570
87455
  }(Entity);const DEFAULT_PARTICLE_COLOR = PALETTES.BASE.BLACK;
87571
87456
  const SYSTEM_DISPOSE_TIMEOUT = 700;
87572
87457
 
@@ -87588,6 +87473,8 @@ let ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
87588
87473
  texture = false,
87589
87474
  color = DEFAULT_PARTICLE_COLOR,
87590
87475
  rate,
87476
+ autoEmit = false,
87477
+ emitWhenEditing = false,
87591
87478
  ...rest
87592
87479
  } = options;
87593
87480
  const parsedOptions = {
@@ -87596,6 +87483,8 @@ let ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
87596
87483
  texture,
87597
87484
  color,
87598
87485
  rate,
87486
+ autoEmit,
87487
+ emitWhenEditing,
87599
87488
  ...rest
87600
87489
  };
87601
87490
  _this = _super.call(this, parsedOptions);
@@ -87610,6 +87499,10 @@ let ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
87610
87499
 
87611
87500
  _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.PROTON_EMITTER);
87612
87501
 
87502
+ if (autoEmit || emitWhenEditing) {
87503
+ _this.emit();
87504
+ }
87505
+
87613
87506
  return _this;
87614
87507
  }
87615
87508
 
@@ -87656,13 +87549,119 @@ let ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
87656
87549
  behaviours.forEach(behaviour => this.system.addBehaviour(behaviour));
87657
87550
  }
87658
87551
  }, {
87659
- key: "emit",
87660
- value: function emit() {
87661
- let duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "once";
87662
- let life = arguments.length > 1 ? arguments[1] : undefined;
87552
+ key: "rebuildSystem",
87553
+ value: function rebuildSystem(_ref) {
87554
+ let {
87555
+ rate,
87556
+ initializers = [],
87557
+ behaviours = [],
87558
+ texture,
87559
+ color
87560
+ } = _ref;
87561
+ const wasEmitting = this.hasSystem() && !this.system.dead;
87562
+
87563
+ if (this.hasSystem()) {
87564
+ this.system.stopEmit();
87565
+ this.system.removeAllParticles(); // Clear existing initializers and behaviours
87566
+
87567
+ this.system.initializes.length = 0;
87568
+ this.system.behaviours.length = 0;
87569
+ } // Update options so setSystem can re-read if needed
87570
+
87571
+
87572
+ this.options = { ...this.options,
87573
+ rate,
87574
+ initializers,
87575
+ behaviours,
87576
+ texture,
87577
+ color
87578
+ }; // Set new rate
87579
+
87580
+ this.system.rate = rate; // Re-add initializers
87581
+
87582
+ initializers.forEach(init => this.system.addInitialize(init));
87583
+
87584
+ if (texture) {
87585
+ this.system.addInitialize(new Proton.Body(this.createParticleBody(texture, color)));
87586
+ } // Re-add behaviours
87587
+
87588
+
87589
+ behaviours.forEach(beh => this.system.addBehaviour(beh)); // Re-emit if was emitting
87590
+
87591
+ if (wasEmitting) {
87592
+ this.emit();
87593
+ }
87594
+ } // Override in subclasses to rebuild from particleConfig
87595
+
87596
+ }, {
87597
+ key: "rebuild",
87598
+ value: function rebuild() {}
87599
+ }, {
87600
+ key: "setTexture",
87601
+ value: function setTexture(texture) {
87602
+ this.particleConfig.texture = texture;
87603
+ this.rebuild();
87604
+ }
87605
+ }, {
87606
+ key: "getTexture",
87607
+ value: function getTexture() {
87608
+ return this.particleConfig.texture;
87609
+ }
87610
+ }, {
87611
+ key: "setAutoEmit",
87612
+ value: function setAutoEmit(autoEmit) {
87613
+ this.particleConfig.autoEmit = autoEmit;
87614
+ }
87615
+ }, {
87616
+ key: "getAutoEmit",
87617
+ value: function getAutoEmit() {
87618
+ return this.particleConfig.autoEmit;
87619
+ }
87620
+ }, {
87621
+ key: "setEmitWhenEditing",
87622
+ value: function setEmitWhenEditing(emitWhenEditing) {
87623
+ this.particleConfig.emitWhenEditing = emitWhenEditing;
87624
+ }
87625
+ }, {
87626
+ key: "getEmitWhenEditing",
87627
+ value: function getEmitWhenEditing() {
87628
+ return this.particleConfig.emitWhenEditing;
87629
+ }
87630
+ }, {
87631
+ key: "setEmitMode",
87632
+ value: function setEmitMode(emitMode) {
87633
+ this.particleConfig.emitMode = emitMode;
87634
+ }
87635
+ }, {
87636
+ key: "getEmitMode",
87637
+ value: function getEmitMode() {
87638
+ return this.particleConfig.emitMode || "continuous";
87639
+ }
87640
+ }, {
87641
+ key: "setEmitDuration",
87642
+ value: function setEmitDuration(emitDuration) {
87643
+ this.particleConfig.emitDuration = emitDuration;
87644
+ }
87645
+ }, {
87646
+ key: "getEmitDuration",
87647
+ value: function getEmitDuration() {
87648
+ return this.particleConfig.emitDuration || 1;
87649
+ }
87650
+ }, {
87651
+ key: "getEmitDurationValue",
87652
+ value: function getEmitDurationValue() {
87653
+ const mode = this.getEmitMode();
87654
+ if (mode === "continuous") return Infinity;
87655
+ if (mode === "burst") return 0.1; // timed
87663
87656
 
87657
+ return this.getEmitDuration();
87658
+ }
87659
+ }, {
87660
+ key: "emit",
87661
+ value: function emit(duration, life) {
87664
87662
  if (this.hasSystem()) {
87665
- this.system.emit(duration, life);
87663
+ const d = duration !== undefined ? duration : this.getEmitDurationValue();
87664
+ this.system.emit(d, life);
87666
87665
  }
87667
87666
 
87668
87667
  return this;
@@ -87699,7 +87698,454 @@ let ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
87699
87698
  }]);
87700
87699
 
87701
87700
  return ProtonParticleEmitter;
87702
- }(ParticleEmitter);const DEFAULT_SIZE$1 = 4;
87701
+ }(ParticleEmitter);const getFountainRate = () => new Proton.Rate(new Proton.Span(5, 10), new Proton.Span(0.05, 0.1));
87702
+
87703
+ const getFountainInitializers = (size, strength) => [new Proton.Mass(1), new Proton.Life(2, 4), new Proton.Radius(size / 2, size), new Proton.Position(new Proton.SphereZone(size / 2)), new Proton.V(new Proton.Span(strength, strength * 1.5), new Proton.Vector3D(0, 1, 0), 30)];
87704
+
87705
+ const getFountainBehaviours = (gravity, colors) => [new Proton.Alpha(1, 0, Infinity, Proton.easeOutSine), new Proton.Scale(new Proton.Span(1, 1.5), 0.1), new Proton.G(gravity), new Proton.Color(colors[0], colors[1], Infinity, Proton.easeLinear), new Proton.RandomDrift(1, 0, 1, 0.5)];
87706
+
87707
+ let Fountain = /*#__PURE__*/function (_ProtonParticleEmitte) {
87708
+ _inherits(Fountain, _ProtonParticleEmitte);
87709
+
87710
+ var _super = _createSuper(Fountain);
87711
+
87712
+ function Fountain() {
87713
+ var _this;
87714
+
87715
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87716
+
87717
+ _classCallCheck(this, Fountain);
87718
+
87719
+ const {
87720
+ texture,
87721
+ size = 5,
87722
+ strength = 25,
87723
+ gravity = 3,
87724
+ colors = [PALETTES.FRENCH.FLAT_FLESH, PALETTES.FRENCH.MELON_MELODY],
87725
+ autoEmit = false,
87726
+ emitWhenEditing = false,
87727
+ ...rest
87728
+ } = options;
87729
+ const fountainOptions = {
87730
+ rate: getFountainRate(),
87731
+ texture,
87732
+ initializers: getFountainInitializers(size, strength),
87733
+ behaviours: getFountainBehaviours(gravity, colors),
87734
+ autoEmit,
87735
+ emitWhenEditing,
87736
+ ...rest
87737
+ };
87738
+ _this = _super.call(this, fountainOptions);
87739
+
87740
+ _this.setPreset("fountain");
87741
+
87742
+ _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.FOUNTAIN);
87743
+
87744
+ _this.setParticleConfig({
87745
+ texture,
87746
+ size,
87747
+ strength,
87748
+ gravity,
87749
+ colors,
87750
+ autoEmit,
87751
+ emitWhenEditing
87752
+ });
87753
+
87754
+ return _this;
87755
+ }
87756
+
87757
+ _createClass(Fountain, [{
87758
+ key: "rebuild",
87759
+ value: function rebuild() {
87760
+ const config = this.getParticleConfig();
87761
+ const {
87762
+ texture,
87763
+ size = 5,
87764
+ strength = 25,
87765
+ gravity = 3,
87766
+ colors = [PALETTES.FRENCH.FLAT_FLESH, PALETTES.FRENCH.MELON_MELODY]
87767
+ } = config;
87768
+ this.rebuildSystem({
87769
+ rate: getFountainRate(),
87770
+ initializers: getFountainInitializers(size, strength),
87771
+ behaviours: getFountainBehaviours(gravity, colors),
87772
+ texture
87773
+ });
87774
+ }
87775
+ }, {
87776
+ key: "setSize",
87777
+ value: function setSize(size) {
87778
+ this.particleConfig.size = size;
87779
+ this.rebuild();
87780
+ }
87781
+ }, {
87782
+ key: "getSize",
87783
+ value: function getSize() {
87784
+ return this.particleConfig.size;
87785
+ }
87786
+ }, {
87787
+ key: "setStrength",
87788
+ value: function setStrength(strength) {
87789
+ this.particleConfig.strength = strength;
87790
+ this.rebuild();
87791
+ }
87792
+ }, {
87793
+ key: "getStrength",
87794
+ value: function getStrength() {
87795
+ return this.particleConfig.strength;
87796
+ }
87797
+ }, {
87798
+ key: "setGravity",
87799
+ value: function setGravity(gravity) {
87800
+ this.particleConfig.gravity = gravity;
87801
+ this.rebuild();
87802
+ }
87803
+ }, {
87804
+ key: "getGravity",
87805
+ value: function getGravity() {
87806
+ return this.particleConfig.gravity;
87807
+ }
87808
+ }, {
87809
+ key: "setColors",
87810
+ value: function setColors(colors) {
87811
+ this.particleConfig.colors = colors;
87812
+ this.rebuild();
87813
+ }
87814
+ }, {
87815
+ key: "getColors",
87816
+ value: function getColors() {
87817
+ return this.particleConfig.colors;
87818
+ }
87819
+ }]);
87820
+
87821
+ return Fountain;
87822
+ }(ProtonParticleEmitter);let ParticleEmitterGroup = /*#__PURE__*/function (_Entity) {
87823
+ _inherits(ParticleEmitterGroup, _Entity);
87824
+
87825
+ var _super = _createSuper(ParticleEmitterGroup);
87826
+
87827
+ function ParticleEmitterGroup() {
87828
+ var _this;
87829
+
87830
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87831
+
87832
+ _classCallCheck(this, ParticleEmitterGroup);
87833
+
87834
+ _this = _super.call(this, {
87835
+ tag: "particle "
87836
+ });
87837
+ const {
87838
+ name = generateRandomName("EmitterGroup"),
87839
+ system,
87840
+ autoEmit = false,
87841
+ emitWhenEditing = false
87842
+ } = options;
87843
+ _this.options = { ...options,
87844
+ name,
87845
+ autoEmit,
87846
+ emitWhenEditing
87847
+ };
87848
+ _this.system = new Map();
87849
+ _this.particleConfig = {};
87850
+ _this.preset = null;
87851
+ _this._sceneEmitter = false;
87852
+ _this.isUsingHelper = undefined;
87853
+ _this.holder = undefined;
87854
+
87855
+ _this.setBody({
87856
+ body: new Object3D()
87857
+ });
87858
+
87859
+ _this.setName(name);
87860
+
87861
+ _this.setEntityType(ENTITY_TYPES.PARTICLE.TYPE);
87862
+
87863
+ _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.EMITTER_GROUP);
87864
+
87865
+ _this.setSystem(system);
87866
+
87867
+ if (autoEmit || emitWhenEditing) {
87868
+ _this.emit();
87869
+ }
87870
+
87871
+ return _this;
87872
+ }
87873
+
87874
+ _createClass(ParticleEmitterGroup, [{
87875
+ key: "setBody",
87876
+ value: function setBody(_ref) {
87877
+ let {
87878
+ body
87879
+ } = _ref;
87880
+ this.body = body;
87881
+
87882
+ if (this.hasBody()) {
87883
+ this.addToScene();
87884
+ }
87885
+ }
87886
+ }, {
87887
+ key: "addToScene",
87888
+ value: function addToScene() {
87889
+ const {
87890
+ addUniverse = true
87891
+ } = this.options;
87892
+
87893
+ if (this.hasBody()) {
87894
+ Scene$1.add(this.getBody(), this, addUniverse);
87895
+ } else {
87896
+ console.warn(ELEMENT_NOT_SET);
87897
+ }
87898
+ }
87899
+ }, {
87900
+ key: "isProtonEmitter",
87901
+ value: function isProtonEmitter() {
87902
+ let result = false;
87903
+ this.system.forEach(emitter => {
87904
+ if (emitter.isProtonEmitter()) result = true;
87905
+ });
87906
+ return result;
87907
+ }
87908
+ }, {
87909
+ key: "getType",
87910
+ value: function getType() {
87911
+ return PARTICLE_EMITTER_TYPES.GROUP;
87912
+ }
87913
+ }, {
87914
+ key: "hasSystem",
87915
+ value: function hasSystem() {
87916
+ return !!this.system && !!this.system.size > 0;
87917
+ }
87918
+ }, {
87919
+ key: "isSystemDead",
87920
+ value: function isSystemDead() {
87921
+ let allDead = true;
87922
+ this.system.forEach(emitter => {
87923
+ if (!emitter.isSystemDead()) allDead = false;
87924
+ });
87925
+ return this.system.size > 0 && allDead;
87926
+ }
87927
+ }, {
87928
+ key: "setSystem",
87929
+ value: function setSystem() {
87930
+ let system = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
87931
+ system.forEach(emitter => {
87932
+ this.add(emitter);
87933
+ this.system.set(emitter.getName(), emitter);
87934
+ });
87935
+ }
87936
+ }, {
87937
+ key: "getSystem",
87938
+ value: function getSystem() {
87939
+ return this.system;
87940
+ }
87941
+ }, {
87942
+ key: "getEmitter",
87943
+ value: function getEmitter(name) {
87944
+ const emitter = this.system.get(name);
87945
+
87946
+ if (emitter) {
87947
+ return emitter;
87948
+ } else {
87949
+ console.log(EMITTER_NOT_FOUND, name);
87950
+ }
87951
+ }
87952
+ }, {
87953
+ key: "forEach",
87954
+ value: function forEach(cb) {
87955
+ this.system.forEach(emitter => cb(emitter));
87956
+ }
87957
+ }, {
87958
+ key: "emit",
87959
+ value: function emit(duration, life) {
87960
+ if (this.hasSystem()) {
87961
+ const d = duration !== undefined ? duration : this.getEmitDurationValue();
87962
+ this.system.forEach(emitter => emitter.emit(d, life));
87963
+ }
87964
+ }
87965
+ }, {
87966
+ key: "stop",
87967
+ value: function stop() {
87968
+ if (this.hasSystem()) {
87969
+ this.system.forEach(emitter => emitter.stop());
87970
+ }
87971
+ } // Override in subclasses to rebuild from particleConfig
87972
+
87973
+ }, {
87974
+ key: "rebuild",
87975
+ value: function rebuild() {}
87976
+ }, {
87977
+ key: "setAutoEmit",
87978
+ value: function setAutoEmit(autoEmit) {
87979
+ this.particleConfig.autoEmit = autoEmit;
87980
+ }
87981
+ }, {
87982
+ key: "getAutoEmit",
87983
+ value: function getAutoEmit() {
87984
+ return this.particleConfig.autoEmit;
87985
+ }
87986
+ }, {
87987
+ key: "setEmitWhenEditing",
87988
+ value: function setEmitWhenEditing(emitWhenEditing) {
87989
+ this.particleConfig.emitWhenEditing = emitWhenEditing;
87990
+ }
87991
+ }, {
87992
+ key: "getEmitWhenEditing",
87993
+ value: function getEmitWhenEditing() {
87994
+ return this.particleConfig.emitWhenEditing;
87995
+ }
87996
+ }, {
87997
+ key: "setEmitMode",
87998
+ value: function setEmitMode(emitMode) {
87999
+ this.particleConfig.emitMode = emitMode;
88000
+ }
88001
+ }, {
88002
+ key: "getEmitMode",
88003
+ value: function getEmitMode() {
88004
+ return this.particleConfig.emitMode || "continuous";
88005
+ }
88006
+ }, {
88007
+ key: "setEmitDuration",
88008
+ value: function setEmitDuration(emitDuration) {
88009
+ this.particleConfig.emitDuration = emitDuration;
88010
+ }
88011
+ }, {
88012
+ key: "getEmitDuration",
88013
+ value: function getEmitDuration() {
88014
+ return this.particleConfig.emitDuration || 1;
88015
+ }
88016
+ }, {
88017
+ key: "getEmitDurationValue",
88018
+ value: function getEmitDurationValue() {
88019
+ const mode = this.getEmitMode();
88020
+ if (mode === "continuous") return Infinity;
88021
+ if (mode === "burst") return 0.1;
88022
+ return this.getEmitDuration();
88023
+ }
88024
+ }, {
88025
+ key: "setParticleConfig",
88026
+ value: function setParticleConfig(config) {
88027
+ this.particleConfig = config;
88028
+ }
88029
+ }, {
88030
+ key: "getParticleConfig",
88031
+ value: function getParticleConfig() {
88032
+ return this.particleConfig;
88033
+ }
88034
+ }, {
88035
+ key: "addHolder",
88036
+ value: function addHolder() {
88037
+ let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "particleholder";
88038
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;
88039
+ const holderSprite = new HelperSprite(size, size, name, {
88040
+ name
88041
+ });
88042
+
88043
+ if (holderSprite) {
88044
+ holderSprite.setSizeAttenuation(false);
88045
+ holderSprite.setDepthTest(false);
88046
+ holderSprite.setDepthWrite(false);
88047
+ holderSprite.setSerializable(false);
88048
+ holderSprite.setPosition(this.getPosition());
88049
+ holderSprite.addTags([TAGS.HELPER, TAGS.PARTICLES.HELPER, TAGS.PARTICLES.HOLDER, name]);
88050
+ holderSprite.setHelperTarget(this);
88051
+ this.holder = holderSprite;
88052
+ return true;
88053
+ }
88054
+
88055
+ return false;
88056
+ }
88057
+ }, {
88058
+ key: "addHelpers",
88059
+ value: function addHelpers() {
88060
+ let {
88061
+ holderName = "particleholder",
88062
+ holderSize = 0.15
88063
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
88064
+ this.addHolder(holderName, holderSize);
88065
+ this.isUsingHelper = true;
88066
+ }
88067
+ }, {
88068
+ key: "usingHelper",
88069
+ value: function usingHelper() {
88070
+ return !!this.isUsingHelper;
88071
+ }
88072
+ }, {
88073
+ key: "hasHolder",
88074
+ value: function hasHolder() {
88075
+ return !!this.holder;
88076
+ }
88077
+ }, {
88078
+ key: "setPosition",
88079
+ value: function setPosition(where) {
88080
+ let {
88081
+ updateHolder = true
88082
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
88083
+
88084
+ _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "setPosition", this).call(this, where);
88085
+
88086
+ if (this.hasHolder() && updateHolder) {
88087
+ this.holder.setPosition(this.getPosition());
88088
+ }
88089
+ }
88090
+ }, {
88091
+ key: "setPreset",
88092
+ value: function setPreset(preset) {
88093
+ this.preset = preset;
88094
+ }
88095
+ }, {
88096
+ key: "getPreset",
88097
+ value: function getPreset() {
88098
+ return this.preset;
88099
+ }
88100
+ }, {
88101
+ key: "setSceneEmitter",
88102
+ value: function setSceneEmitter(value) {
88103
+ this._sceneEmitter = !!value;
88104
+ }
88105
+ }, {
88106
+ key: "isSceneEmitter",
88107
+ value: function isSceneEmitter() {
88108
+ return this._sceneEmitter;
88109
+ }
88110
+ }, {
88111
+ key: "toJSON",
88112
+ value: function toJSON() {
88113
+ let parseJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
88114
+
88115
+ const base = _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "toJSON", this).call(this, parseJSON);
88116
+
88117
+ if (!base) return base;
88118
+ return { ...base,
88119
+ preset: this.preset,
88120
+ options: this.particleConfig
88121
+ };
88122
+ }
88123
+ }, {
88124
+ key: "dispose",
88125
+ value: function dispose() {
88126
+ _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "dispose", this).call(this);
88127
+
88128
+ this.system.forEach(emitter => emitter.dispose());
88129
+ }
88130
+ }, {
88131
+ key: "update",
88132
+ value: function update(dt) {
88133
+ _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "update", this).call(this, dt);
88134
+
88135
+ if (this.usingHelper()) {
88136
+ this.setPosition(this.holder.getPosition(), {
88137
+ updateHolder: false
88138
+ });
88139
+ }
88140
+
88141
+ if (this.hasSystem()) {
88142
+ this.system.forEach(emitter => emitter.update(dt));
88143
+ }
88144
+ }
88145
+ }]);
88146
+
88147
+ return ParticleEmitterGroup;
88148
+ }(Entity);const DEFAULT_SIZE$1 = 4;
87703
88149
 
87704
88150
  const getSparksInitializers = function () {
87705
88151
  let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_SIZE$1;
@@ -87708,7 +88154,7 @@ const getSparksInitializers = function () {
87708
88154
 
87709
88155
  const getSparksBehaviours = function () {
87710
88156
  let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_SIZE$1;
87711
- return [new Proton.RandomDrift(size * 0.75, size * 0.75, size * 0.75, 0.5), new Proton.Color("#ffffff"), new Proton.Scale(1, 0.1)];
88157
+ return [new Proton.Alpha(1, 0), new Proton.RandomDrift(size * 0.75, size * 0.75, size * 0.75, 0.5), new Proton.Color("#ffffff"), new Proton.Scale(1, 0.1)];
87712
88158
  };
87713
88159
 
87714
88160
  const getSparksRate = () => new Proton.Rate(50, 0.5);
@@ -87727,7 +88173,7 @@ const getDebrisBehaviours = function () {
87727
88173
  const zone = new Proton.BoxZone(0, 50, 0, 300, 100, 300);
87728
88174
  zone.friction = 0.95;
87729
88175
  zone.max = 7;
87730
- return [new Proton.CrossZone(zone, "bound"), new Proton.Repulsion(new Proton.Vector3D(0, 0, 0), size * 12.5, size * 1.5), new Proton.G(3), new Proton.Color("#95a5a6", "#000000")];
88176
+ return [new Proton.Alpha(1, 0), new Proton.CrossZone(zone, "bound"), new Proton.Repulsion(new Proton.Vector3D(0, 0, 0), size * 12.5, size * 1.5), new Proton.G(3), new Proton.Color("#95a5a6", "#000000")];
87731
88177
  };
87732
88178
 
87733
88179
  const getFireInitializers$1 = function () {
@@ -87735,7 +88181,7 @@ const getFireInitializers$1 = function () {
87735
88181
  return [new Proton.Mass(1), new Proton.Radius(size * 1.5), new Proton.Life(0.2, 0.5), new Proton.Position(new Proton.SphereZone(size * 1.25))];
87736
88182
  };
87737
88183
 
87738
- const getFireBehaviours$1 = () => [new Proton.Scale(1, 2), new Proton.Color("#c0392b", "#f1c40f")];
88184
+ const getFireBehaviours$1 = () => [new Proton.Alpha(1, 0), new Proton.Scale(1, 2), new Proton.Color("#c0392b", "#f1c40f")];
87739
88185
 
87740
88186
  let Explosion = /*#__PURE__*/function (_ParticleEmitterGroup) {
87741
88187
  _inherits(Explosion, _ParticleEmitterGroup);
@@ -87752,19 +88198,23 @@ let Explosion = /*#__PURE__*/function (_ParticleEmitterGroup) {
87752
88198
  const {
87753
88199
  texture = false,
87754
88200
  hasDebris = false,
87755
- size = DEFAULT_SIZE$1
88201
+ size = DEFAULT_SIZE$1,
88202
+ autoEmit = false,
88203
+ emitWhenEditing = false
87756
88204
  } = options;
87757
88205
  const sparks = new ProtonParticleEmitter({
87758
88206
  rate: getSparksRate(),
87759
88207
  texture,
87760
88208
  initializers: getSparksInitializers(size),
87761
- behaviours: getSparksBehaviours(size)
88209
+ behaviours: getSparksBehaviours(size),
88210
+ skipSceneAdd: true
87762
88211
  });
87763
88212
  const fire = new ProtonParticleEmitter({
87764
88213
  rate: getFireRate$1(),
87765
88214
  texture,
87766
88215
  initializers: getFireInitializers$1(size),
87767
- behaviours: getFireBehaviours$1()
88216
+ behaviours: getFireBehaviours$1(),
88217
+ skipSceneAdd: true
87768
88218
  });
87769
88219
  const system = [sparks, fire];
87770
88220
 
@@ -87773,21 +88223,98 @@ let Explosion = /*#__PURE__*/function (_ParticleEmitterGroup) {
87773
88223
  rate: getDebrisRate(),
87774
88224
  texture,
87775
88225
  initializers: getDebrisInitializers(size),
87776
- behaviours: getDebrisBehaviours(size)
88226
+ behaviours: getDebrisBehaviours(size),
88227
+ skipSceneAdd: true
87777
88228
  }));
87778
88229
  }
87779
88230
 
87780
88231
  const name = "ExplosionGroup";
87781
88232
  _this = _super.call(this, {
87782
88233
  system,
87783
- name
88234
+ name,
88235
+ autoEmit,
88236
+ emitWhenEditing
87784
88237
  });
87785
88238
 
88239
+ _this.setPreset("explosion");
88240
+
87786
88241
  _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.EXPLOSION);
87787
88242
 
88243
+ _this.setParticleConfig({
88244
+ texture,
88245
+ hasDebris,
88246
+ size,
88247
+ autoEmit,
88248
+ emitWhenEditing,
88249
+ emitMode: "burst"
88250
+ });
88251
+
87788
88252
  return _this;
87789
88253
  }
87790
88254
 
88255
+ _createClass(Explosion, [{
88256
+ key: "rebuild",
88257
+ value: function rebuild() {
88258
+ const config = this.getParticleConfig();
88259
+ const {
88260
+ texture = false,
88261
+ size = DEFAULT_SIZE$1
88262
+ } = config;
88263
+ const emitters = Array.from(this.system.values()); // Rebuild sparks (first emitter)
88264
+
88265
+ if (emitters[0]) {
88266
+ emitters[0].rebuildSystem({
88267
+ rate: getSparksRate(),
88268
+ initializers: getSparksInitializers(size),
88269
+ behaviours: getSparksBehaviours(size),
88270
+ texture
88271
+ });
88272
+ } // Rebuild fire (second emitter)
88273
+
88274
+
88275
+ if (emitters[1]) {
88276
+ emitters[1].rebuildSystem({
88277
+ rate: getFireRate$1(),
88278
+ initializers: getFireInitializers$1(size),
88279
+ behaviours: getFireBehaviours$1(),
88280
+ texture
88281
+ });
88282
+ } // Rebuild debris (third emitter, if exists)
88283
+
88284
+
88285
+ if (emitters[2]) {
88286
+ emitters[2].rebuildSystem({
88287
+ rate: getDebrisRate(),
88288
+ initializers: getDebrisInitializers(size),
88289
+ behaviours: getDebrisBehaviours(size),
88290
+ texture
88291
+ });
88292
+ }
88293
+ }
88294
+ }, {
88295
+ key: "setSize",
88296
+ value: function setSize(size) {
88297
+ this.particleConfig.size = size;
88298
+ this.rebuild();
88299
+ }
88300
+ }, {
88301
+ key: "getSize",
88302
+ value: function getSize() {
88303
+ return this.particleConfig.size;
88304
+ }
88305
+ }, {
88306
+ key: "setTexture",
88307
+ value: function setTexture(texture) {
88308
+ this.particleConfig.texture = texture;
88309
+ this.rebuild();
88310
+ }
88311
+ }, {
88312
+ key: "getTexture",
88313
+ value: function getTexture() {
88314
+ return this.particleConfig.texture;
88315
+ }
88316
+ }]);
88317
+
87791
88318
  return Explosion;
87792
88319
  }(ParticleEmitterGroup);const getFireRate = () => new Proton.Rate(new Proton.Span(10, 15), new Proton.Span(0.05, 0.1));
87793
88320
 
@@ -87796,7 +88323,7 @@ const getFireInitializers = (direction, strength, size) => [new Proton.Mass(1),
87796
88323
 
87797
88324
  const getFireBehaviours = function (direction, strength) {
87798
88325
  let colors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [PALETTES.FRENCH.MANDARIN_RED, PALETTES.FRENCH.MELON_MELODY];
87799
- return [new Proton.Scale(new Proton.Span(2, 2.5), 0), new Proton.G(strength / 100), new Proton.Color(colors[0], colors[1], Infinity, Proton.easeOutSine), new Proton.RandomDrift(direction.x / 100, direction.y / 100, direction.z / 100, 2.5)];
88326
+ return [new Proton.Alpha(1, 0.1), new Proton.Scale(new Proton.Span(2, 2.5), 0), new Proton.G(strength / 100), new Proton.Color(colors[0], colors[1], Infinity, Proton.easeOutSine), new Proton.RandomDrift(direction.x / 100, direction.y / 100, direction.z / 100, 2.5)];
87800
88327
  };
87801
88328
 
87802
88329
  let Fire = /*#__PURE__*/function (_ProtonParticleEmitte) {
@@ -87804,9 +88331,11 @@ let Fire = /*#__PURE__*/function (_ProtonParticleEmitte) {
87804
88331
 
87805
88332
  var _super = _createSuper(Fire);
87806
88333
 
87807
- function Fire(options) {
88334
+ function Fire() {
87808
88335
  var _this;
87809
88336
 
88337
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
88338
+
87810
88339
  _classCallCheck(this, Fire);
87811
88340
 
87812
88341
  const {
@@ -87815,6 +88344,8 @@ let Fire = /*#__PURE__*/function (_ProtonParticleEmitte) {
87815
88344
  size = 20,
87816
88345
  strength = 100,
87817
88346
  colors,
88347
+ autoEmit = false,
88348
+ emitWhenEditing = false,
87818
88349
  ...rest
87819
88350
  } = options;
87820
88351
  const fireOptions = {
@@ -87822,129 +88353,388 @@ let Fire = /*#__PURE__*/function (_ProtonParticleEmitte) {
87822
88353
  texture,
87823
88354
  initializers: getFireInitializers(direction, strength, size),
87824
88355
  behaviours: getFireBehaviours(direction, strength, colors),
88356
+ autoEmit,
88357
+ emitWhenEditing,
87825
88358
  ...rest
87826
88359
  };
87827
88360
  _this = _super.call(this, fireOptions);
87828
88361
 
88362
+ _this.setPreset("fire");
88363
+
87829
88364
  _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.FIRE);
87830
88365
 
88366
+ _this.setParticleConfig({
88367
+ texture,
88368
+ direction: {
88369
+ x: direction.x,
88370
+ y: direction.y,
88371
+ z: direction.z
88372
+ },
88373
+ size,
88374
+ strength,
88375
+ colors,
88376
+ autoEmit,
88377
+ emitWhenEditing
88378
+ });
88379
+
87831
88380
  return _this;
87832
88381
  }
87833
88382
 
88383
+ _createClass(Fire, [{
88384
+ key: "rebuild",
88385
+ value: function rebuild() {
88386
+ const config = this.getParticleConfig();
88387
+ const {
88388
+ texture,
88389
+ direction = {
88390
+ x: 0,
88391
+ y: 1,
88392
+ z: 0
88393
+ },
88394
+ size = 20,
88395
+ strength = 100,
88396
+ colors
88397
+ } = config;
88398
+ const dir = new Vector3$1(direction.x, direction.y, direction.z);
88399
+ this.rebuildSystem({
88400
+ rate: getFireRate(),
88401
+ initializers: getFireInitializers(dir, strength, size),
88402
+ behaviours: getFireBehaviours(dir, strength, colors),
88403
+ texture
88404
+ });
88405
+ }
88406
+ }, {
88407
+ key: "setSize",
88408
+ value: function setSize(size) {
88409
+ this.particleConfig.size = size;
88410
+ this.rebuild();
88411
+ }
88412
+ }, {
88413
+ key: "getSize",
88414
+ value: function getSize() {
88415
+ return this.particleConfig.size;
88416
+ }
88417
+ }, {
88418
+ key: "setStrength",
88419
+ value: function setStrength(strength) {
88420
+ this.particleConfig.strength = strength;
88421
+ this.rebuild();
88422
+ }
88423
+ }, {
88424
+ key: "getStrength",
88425
+ value: function getStrength() {
88426
+ return this.particleConfig.strength;
88427
+ }
88428
+ }, {
88429
+ key: "setDirection",
88430
+ value: function setDirection(direction) {
88431
+ this.particleConfig.direction = direction;
88432
+ this.rebuild();
88433
+ }
88434
+ }, {
88435
+ key: "getDirection",
88436
+ value: function getDirection() {
88437
+ return this.particleConfig.direction;
88438
+ }
88439
+ }, {
88440
+ key: "setColors",
88441
+ value: function setColors(colors) {
88442
+ this.particleConfig.colors = colors;
88443
+ this.rebuild();
88444
+ }
88445
+ }, {
88446
+ key: "getColors",
88447
+ value: function getColors() {
88448
+ return this.particleConfig.colors;
88449
+ }
88450
+ }]);
88451
+
87834
88452
  return Fire;
87835
- }(ProtonParticleEmitter);let Rain = /*#__PURE__*/function (_ParticleEmitter) {
87836
- _inherits(Rain, _ParticleEmitter);
88453
+ }(ProtonParticleEmitter);const getRainRate = particleCount => new Proton.Rate(new Proton.Span(particleCount / 10, particleCount / 5), new Proton.Span(0.01, 0.02));
88454
+
88455
+ const getRainInitializers = (size, strength, area) => [new Proton.Mass(0.5), new Proton.Life(2, 5), new Proton.Radius(size / 4, size / 2), new Proton.Position(new Proton.BoxZone(area, 0, area)), new Proton.V(new Proton.Span(strength, strength * 1.5), new Proton.Vector3D(0, -1, 0), 2)];
88456
+
88457
+ const getRainBehaviours = (strength, colors) => [new Proton.Alpha(1, 0), new Proton.Scale(new Proton.Span(0.3, 0.5), 0.1), new Proton.G(strength / 10), new Proton.Color(colors[0], colors[1], Infinity, Proton.easeLinear), new Proton.RandomDrift(0.5, 0, 0.5, 0.5)];
88458
+
88459
+ let Rain = /*#__PURE__*/function (_ProtonParticleEmitte) {
88460
+ _inherits(Rain, _ProtonParticleEmitte);
87837
88461
 
87838
88462
  var _super = _createSuper(Rain);
87839
88463
 
87840
- function Rain(_ref) {
88464
+ function Rain() {
87841
88465
  var _this;
87842
88466
 
87843
- let {
87844
- container,
87845
- autostart,
87846
- particles,
87847
- system
87848
- } = _ref;
88467
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87849
88468
 
87850
88469
  _classCallCheck(this, Rain);
87851
88470
 
87852
- const options = {
87853
- container,
87854
- autostart,
87855
- particles: {
87856
- globalSize: 0.4,
87857
- ttl: 5,
87858
- velocity: new Vector3$1(0, -2, 0),
87859
- velocityBonus: new Vector3$1(0, -60, 0),
87860
- gravity: -10,
87861
- startAlpha: 1,
87862
- endAlpha: 0,
87863
- startColor: new Color$1(1, 1, 1),
87864
- endColor: new Color$1(0, 0, 0),
87865
- startAlphaChangeAt: 0,
87866
- blending: "additive",
87867
- onSpawn: particle => {
87868
- particle.position.x = Math.random() * 100;
87869
- particle.position.z = Math.random() * 100;
87870
- },
87871
- ...particles
87872
- },
87873
- system: {
87874
- particlesCount: 2000,
87875
- emitters: new k({
87876
- onInterval: new N.MinMaxRandomizer(0, 5),
87877
- interval: new N.MinMaxRandomizer(0, 0.25)
87878
- }),
87879
- speed: 1.5,
87880
- ...system
87881
- }
88471
+ const {
88472
+ texture,
88473
+ size = 1,
88474
+ strength = 60,
88475
+ area = 100,
88476
+ particleCount = 200,
88477
+ colors = ["#ffffff", "#000000"],
88478
+ autoEmit = false,
88479
+ emitWhenEditing = false,
88480
+ ...rest
88481
+ } = options;
88482
+ const rainOptions = {
88483
+ rate: getRainRate(particleCount),
88484
+ texture,
88485
+ initializers: getRainInitializers(size, strength, area),
88486
+ behaviours: getRainBehaviours(strength, colors),
88487
+ autoEmit,
88488
+ emitWhenEditing,
88489
+ ...rest
87882
88490
  };
87883
- _this = _super.call(this, options);
88491
+ _this = _super.call(this, rainOptions);
88492
+
88493
+ _this.setPreset("rain");
87884
88494
 
87885
88495
  _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.RAIN);
87886
88496
 
88497
+ _this.setParticleConfig({
88498
+ texture,
88499
+ size,
88500
+ strength,
88501
+ area,
88502
+ particleCount,
88503
+ colors,
88504
+ autoEmit,
88505
+ emitWhenEditing
88506
+ });
88507
+
87887
88508
  return _this;
87888
88509
  }
87889
88510
 
88511
+ _createClass(Rain, [{
88512
+ key: "rebuild",
88513
+ value: function rebuild() {
88514
+ const config = this.getParticleConfig();
88515
+ const {
88516
+ texture,
88517
+ size = 1,
88518
+ strength = 60,
88519
+ area = 100,
88520
+ particleCount = 200,
88521
+ colors = ["#ffffff", "#000000"]
88522
+ } = config;
88523
+ this.rebuildSystem({
88524
+ rate: getRainRate(particleCount),
88525
+ initializers: getRainInitializers(size, strength, area),
88526
+ behaviours: getRainBehaviours(strength, colors),
88527
+ texture
88528
+ });
88529
+ }
88530
+ }, {
88531
+ key: "setSize",
88532
+ value: function setSize(size) {
88533
+ this.particleConfig.size = size;
88534
+ this.rebuild();
88535
+ }
88536
+ }, {
88537
+ key: "getSize",
88538
+ value: function getSize() {
88539
+ return this.particleConfig.size;
88540
+ }
88541
+ }, {
88542
+ key: "setStrength",
88543
+ value: function setStrength(strength) {
88544
+ this.particleConfig.strength = strength;
88545
+ this.rebuild();
88546
+ }
88547
+ }, {
88548
+ key: "getStrength",
88549
+ value: function getStrength() {
88550
+ return this.particleConfig.strength;
88551
+ }
88552
+ }, {
88553
+ key: "setArea",
88554
+ value: function setArea(area) {
88555
+ this.particleConfig.area = area;
88556
+ this.rebuild();
88557
+ }
88558
+ }, {
88559
+ key: "getArea",
88560
+ value: function getArea() {
88561
+ return this.particleConfig.area;
88562
+ }
88563
+ }, {
88564
+ key: "setParticleCount",
88565
+ value: function setParticleCount(particleCount) {
88566
+ this.particleConfig.particleCount = particleCount;
88567
+ this.rebuild();
88568
+ }
88569
+ }, {
88570
+ key: "getParticleCount",
88571
+ value: function getParticleCount() {
88572
+ return this.particleConfig.particleCount;
88573
+ }
88574
+ }, {
88575
+ key: "setColors",
88576
+ value: function setColors(colors) {
88577
+ this.particleConfig.colors = colors;
88578
+ this.rebuild();
88579
+ }
88580
+ }, {
88581
+ key: "getColors",
88582
+ value: function getColors() {
88583
+ return this.particleConfig.colors;
88584
+ }
88585
+ }]);
88586
+
87890
88587
  return Rain;
87891
- }(ParticleEmitter);let Snow = /*#__PURE__*/function (_ParticleEmitter) {
87892
- _inherits(Snow, _ParticleEmitter);
88588
+ }(ProtonParticleEmitter);const getSnowRate = particleCount => new Proton.Rate(new Proton.Span(particleCount / 10, particleCount / 5), new Proton.Span(0.02, 0.05));
88589
+
88590
+ const getSnowInitializers = (size, strength, area) => [new Proton.Mass(0.3), new Proton.Life(3, 6), new Proton.Radius(size / 2, size), new Proton.Position(new Proton.BoxZone(area, 0, area)), new Proton.V(new Proton.Span(strength / 2, strength), new Proton.Vector3D(0, -1, 0), 15)];
88591
+
88592
+ const getSnowBehaviours = (drift, colors) => [new Proton.Alpha(0.8, 0), new Proton.Scale(new Proton.Span(0.5, 1), 0.2), new Proton.G(0.5), new Proton.Color(colors[0], colors[1], Infinity, Proton.easeLinear), new Proton.RandomDrift(drift, drift / 4, drift, 0.5)];
88593
+
88594
+ let Snow = /*#__PURE__*/function (_ProtonParticleEmitte) {
88595
+ _inherits(Snow, _ProtonParticleEmitte);
87893
88596
 
87894
88597
  var _super = _createSuper(Snow);
87895
88598
 
87896
- function Snow(_ref) {
88599
+ function Snow() {
87897
88600
  var _this;
87898
88601
 
87899
- let {
87900
- container,
87901
- autostart,
87902
- particles,
87903
- system
87904
- } = _ref;
88602
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87905
88603
 
87906
88604
  _classCallCheck(this, Snow);
87907
88605
 
87908
- const options = {
87909
- container,
87910
- autostart,
87911
- particles: {
87912
- globalSize: 0.7,
87913
- ttl: 5,
87914
- velocity: new N.SphereRandomizer(30),
87915
- velocityBonus: new Vector3$1(0, -30, 0),
87916
- gravity: -10,
87917
- startAlpha: 0.8,
87918
- endAlpha: 0,
87919
- startColor: new Color$1(1, 1, 1),
87920
- endColor: new Color$1(0, 0, 0),
87921
- startAlphaChangeAt: 0,
87922
- blending: "blend",
87923
- onSpawn: particle => {
87924
- particle.position.x = Math.random() * 200;
87925
- particle.position.z = Math.random() * 200;
87926
- },
87927
- ...particles
87928
- },
87929
- system: {
87930
- particlesCount: 4000,
87931
- emitters: new k({
87932
- onInterval: new N.MinMaxRandomizer(0, 5),
87933
- interval: new N.MinMaxRandomizer(0, 0.25)
87934
- }),
87935
- speed: 1.5,
87936
- ...system
87937
- }
88606
+ const {
88607
+ texture,
88608
+ size = 2,
88609
+ strength = 30,
88610
+ area = 200,
88611
+ drift = 3,
88612
+ particleCount = 400,
88613
+ colors = [PALETTES.BASE.WHITE, PALETTES.BASE.WHITE],
88614
+ autoEmit = false,
88615
+ emitWhenEditing = false,
88616
+ ...rest
88617
+ } = options;
88618
+ const snowOptions = {
88619
+ rate: getSnowRate(particleCount),
88620
+ texture,
88621
+ initializers: getSnowInitializers(size, strength, area),
88622
+ behaviours: getSnowBehaviours(drift, colors),
88623
+ autoEmit,
88624
+ emitWhenEditing,
88625
+ ...rest
87938
88626
  };
87939
- _this = _super.call(this, options);
88627
+ _this = _super.call(this, snowOptions);
88628
+
88629
+ _this.setPreset("snow");
87940
88630
 
87941
88631
  _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.SNOW);
87942
88632
 
88633
+ _this.setParticleConfig({
88634
+ texture,
88635
+ size,
88636
+ strength,
88637
+ area,
88638
+ drift,
88639
+ particleCount,
88640
+ colors,
88641
+ autoEmit,
88642
+ emitWhenEditing
88643
+ });
88644
+
87943
88645
  return _this;
87944
88646
  }
87945
88647
 
88648
+ _createClass(Snow, [{
88649
+ key: "rebuild",
88650
+ value: function rebuild() {
88651
+ const config = this.getParticleConfig();
88652
+ const {
88653
+ texture,
88654
+ size = 2,
88655
+ strength = 30,
88656
+ area = 200,
88657
+ drift = 3,
88658
+ particleCount = 400,
88659
+ colors = [PALETTES.BASE.WHITE, PALETTES.BASE.WHITE]
88660
+ } = config;
88661
+ this.rebuildSystem({
88662
+ rate: getSnowRate(particleCount),
88663
+ initializers: getSnowInitializers(size, strength, area),
88664
+ behaviours: getSnowBehaviours(drift, colors),
88665
+ texture
88666
+ });
88667
+ }
88668
+ }, {
88669
+ key: "setSize",
88670
+ value: function setSize(size) {
88671
+ this.particleConfig.size = size;
88672
+ this.rebuild();
88673
+ }
88674
+ }, {
88675
+ key: "getSize",
88676
+ value: function getSize() {
88677
+ return this.particleConfig.size;
88678
+ }
88679
+ }, {
88680
+ key: "setStrength",
88681
+ value: function setStrength(strength) {
88682
+ this.particleConfig.strength = strength;
88683
+ this.rebuild();
88684
+ }
88685
+ }, {
88686
+ key: "getStrength",
88687
+ value: function getStrength() {
88688
+ return this.particleConfig.strength;
88689
+ }
88690
+ }, {
88691
+ key: "setArea",
88692
+ value: function setArea(area) {
88693
+ this.particleConfig.area = area;
88694
+ this.rebuild();
88695
+ }
88696
+ }, {
88697
+ key: "getArea",
88698
+ value: function getArea() {
88699
+ return this.particleConfig.area;
88700
+ }
88701
+ }, {
88702
+ key: "setDrift",
88703
+ value: function setDrift(drift) {
88704
+ this.particleConfig.drift = drift;
88705
+ this.rebuild();
88706
+ }
88707
+ }, {
88708
+ key: "getDrift",
88709
+ value: function getDrift() {
88710
+ return this.particleConfig.drift;
88711
+ }
88712
+ }, {
88713
+ key: "setParticleCount",
88714
+ value: function setParticleCount(particleCount) {
88715
+ this.particleConfig.particleCount = particleCount;
88716
+ this.rebuild();
88717
+ }
88718
+ }, {
88719
+ key: "getParticleCount",
88720
+ value: function getParticleCount() {
88721
+ return this.particleConfig.particleCount;
88722
+ }
88723
+ }, {
88724
+ key: "setColors",
88725
+ value: function setColors(colors) {
88726
+ this.particleConfig.colors = colors;
88727
+ this.rebuild();
88728
+ }
88729
+ }, {
88730
+ key: "getColors",
88731
+ value: function getColors() {
88732
+ return this.particleConfig.colors;
88733
+ }
88734
+ }]);
88735
+
87946
88736
  return Snow;
87947
- }(ParticleEmitter);const DEFAULT_SIZE = 4;
88737
+ }(ProtonParticleEmitter);const DEFAULT_SIZE = 4;
87948
88738
 
87949
88739
  const getTrailRate = () => new Proton.Rate(new Proton.Span(10, 20), new Proton.Span(0.01, 0.015));
87950
88740
 
@@ -87966,25 +88756,82 @@ let Trail = /*#__PURE__*/function (_ParticleEmitterGroup) {
87966
88756
 
87967
88757
  const {
87968
88758
  texture = false,
87969
- size = DEFAULT_SIZE
88759
+ size = DEFAULT_SIZE,
88760
+ autoEmit = false,
88761
+ emitWhenEditing = false
87970
88762
  } = options;
87971
88763
  const system = [new ProtonParticleEmitter({
87972
88764
  rate: getTrailRate(),
87973
88765
  texture,
87974
88766
  initializers: getTrailInitialisers(size),
87975
- behaviours: getTrailBehaviour()
88767
+ behaviours: getTrailBehaviour(),
88768
+ skipSceneAdd: true
87976
88769
  })];
87977
88770
  const name = "TrailGroup";
87978
88771
  _this = _super.call(this, {
87979
88772
  system,
87980
- name
88773
+ name,
88774
+ autoEmit,
88775
+ emitWhenEditing
87981
88776
  });
87982
88777
 
88778
+ _this.setPreset("trail");
88779
+
87983
88780
  _this.setEntitySubtype(ENTITY_TYPES.PARTICLE.SUBTYPES.TRAIL);
87984
88781
 
88782
+ _this.setParticleConfig({
88783
+ texture,
88784
+ size,
88785
+ autoEmit,
88786
+ emitWhenEditing
88787
+ });
88788
+
87985
88789
  return _this;
87986
88790
  }
87987
88791
 
88792
+ _createClass(Trail, [{
88793
+ key: "rebuild",
88794
+ value: function rebuild() {
88795
+ const config = this.getParticleConfig();
88796
+ const {
88797
+ texture = false,
88798
+ size = DEFAULT_SIZE
88799
+ } = config;
88800
+ const emitters = Array.from(this.system.values());
88801
+
88802
+ if (emitters[0]) {
88803
+ emitters[0].rebuildSystem({
88804
+ rate: getTrailRate(),
88805
+ initializers: getTrailInitialisers(size),
88806
+ behaviours: getTrailBehaviour(),
88807
+ texture
88808
+ });
88809
+ }
88810
+ }
88811
+ }, {
88812
+ key: "setSize",
88813
+ value: function setSize(size) {
88814
+ this.particleConfig.size = size;
88815
+ this.rebuild();
88816
+ }
88817
+ }, {
88818
+ key: "getSize",
88819
+ value: function getSize() {
88820
+ return this.particleConfig.size;
88821
+ }
88822
+ }, {
88823
+ key: "setTexture",
88824
+ value: function setTexture(texture) {
88825
+ this.particleConfig.texture = texture;
88826
+ this.rebuild();
88827
+ }
88828
+ }, {
88829
+ key: "getTexture",
88830
+ value: function getTexture() {
88831
+ return this.particleConfig.texture;
88832
+ }
88833
+ }]);
88834
+
87988
88835
  return Trail;
87989
88836
  }(ParticleEmitterGroup);const PARTICLES = {
87990
88837
  RAIN: "rain",
@@ -87994,7 +88841,6 @@ let Trail = /*#__PURE__*/function (_ParticleEmitterGroup) {
87994
88841
  SNOW: "snow",
87995
88842
  TRAIL: "trail"
87996
88843
  };
87997
- const DEPRECATED_PARTICLES = [PARTICLES.RAIN, PARTICLES.FOUNTAIN, PARTICLES.SNOW];
87998
88844
  const {
87999
88845
  SINGLE,
88000
88846
  GROUP
@@ -88028,6 +88874,7 @@ let Particles = /*#__PURE__*/function () {
88028
88874
  _createClass(Particles, [{
88029
88875
  key: "init",
88030
88876
  value: function init() {
88877
+ if (this.isInitialised()) return;
88031
88878
  this.proton = new Proton();
88032
88879
  this.proton.addRender(new Proton.SpriteRender(Scene$1.getScene()));
88033
88880
  }
@@ -88055,18 +88902,12 @@ let Particles = /*#__PURE__*/function () {
88055
88902
  key: "addParticleEmitter",
88056
88903
  value: function addParticleEmitter(emitter) {
88057
88904
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
88058
- console.warn(DEPRECATIONS.PARTICLES_ADD_PARTICLE_EMITTER);
88059
88905
  return this.add(emitter, options);
88060
88906
  }
88061
88907
  }, {
88062
88908
  key: "add",
88063
88909
  value: function add(_emitter) {
88064
88910
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
88065
-
88066
- if (DEPRECATED_PARTICLES.includes(_emitter)) {
88067
- console.warn(DEPRECATIONS.PARTICLES_OLD);
88068
- }
88069
-
88070
88911
  let emitter;
88071
88912
 
88072
88913
  if (this.isRegisteredEmitter(_emitter)) {
@@ -88101,6 +88942,10 @@ let Particles = /*#__PURE__*/function () {
88101
88942
  }, {
88102
88943
  key: "addProtonEmitter",
88103
88944
  value: function addProtonEmitter(emitter) {
88945
+ if (!this.isInitialised()) {
88946
+ this.init();
88947
+ }
88948
+
88104
88949
  this.proton.addEmitter(emitter.getSystem());
88105
88950
  }
88106
88951
  }, {
@@ -88124,6 +88969,7 @@ let Particles = /*#__PURE__*/function () {
88124
88969
  value: function disposeDeadEmitters() {
88125
88970
  this.toDispose.forEach(uuid => {
88126
88971
  const emitter = this.emitters.get(uuid);
88972
+ if (!emitter) return;
88127
88973
 
88128
88974
  if (emitter.isProtonEmitter()) {
88129
88975
  this.removeProtonEmitter(emitter);
@@ -88137,6 +88983,7 @@ let Particles = /*#__PURE__*/function () {
88137
88983
  }, {
88138
88984
  key: "update",
88139
88985
  value: function update(dt) {
88986
+ if (!this.isInitialised()) return;
88140
88987
  this.proton.update(dt);
88141
88988
  this.updateEmitters(dt);
88142
88989
  this.disposeDeadEmitters();
@@ -91436,6 +92283,7 @@ let Level = /*#__PURE__*/function (_EventDispatcher) {
91436
92283
 
91437
92284
  Physics$1.dispose();
91438
92285
  Audio$1.dispose();
92286
+ Lights$1.dispose();
91439
92287
  Particles$1.dispose();
91440
92288
  PostProcessing$1.dispose();
91441
92289
  Universe$1.bigfreeze();
@@ -91711,7 +92559,11 @@ var storage = new Storage();let Light$1 = /*#__PURE__*/function (_Entity) {
91711
92559
  key: "addToScene",
91712
92560
  value: function addToScene() {
91713
92561
  if (this.hasBody()) {
91714
- Scene$1.add(this.body, this);
92562
+ Scene$1.add(this.body, this); // When a new light is added to the scene, all materials need
92563
+ // their shaders recompiled so THREE.js picks up the updated
92564
+ // shadow-casting light count (NUM_DIR_LIGHT_SHADOWS, etc.).
92565
+
92566
+ Scene$1.updateChildren();
91715
92567
  }
91716
92568
  }
91717
92569
  }, {
@@ -91808,7 +92660,10 @@ var storage = new Storage();let Light$1 = /*#__PURE__*/function (_Entity) {
91808
92660
  key: "setCastShadow",
91809
92661
  value: function setCastShadow(castShadow) {
91810
92662
  this.castShadow = castShadow;
91811
- this.getBody().castShadow = castShadow;
92663
+ this.getBody().castShadow = castShadow; // Changing shadow-casting state alters the number of active shadow
92664
+ // maps, so every material must recompile its shader.
92665
+
92666
+ Scene$1.updateChildren();
91812
92667
  }
91813
92668
  }, {
91814
92669
  key: "getCastShadow",
@@ -92666,7 +93521,11 @@ let SpotLight$1 = /*#__PURE__*/function (_Light) {
92666
93521
  key: "addToScene",
92667
93522
  value: function addToScene() {
92668
93523
  if (this.hasBody()) {
92669
- Scene$1.add(this.body, this);
93524
+ Scene$1.add(this.body, this); // When a new light is added to the scene, all materials need
93525
+ // their shaders recompiled so THREE.js picks up the updated
93526
+ // shadow-casting light count (NUM_DIR_LIGHT_SHADOWS, etc.).
93527
+
93528
+ Scene$1.updateChildren();
92670
93529
  }
92671
93530
  }
92672
93531
  }, {
@@ -92763,7 +93622,10 @@ let SpotLight$1 = /*#__PURE__*/function (_Light) {
92763
93622
  key: "setCastShadow",
92764
93623
  value: function setCastShadow(castShadow) {
92765
93624
  this.castShadow = castShadow;
92766
- this.getBody().castShadow = castShadow;
93625
+ this.getBody().castShadow = castShadow; // Changing shadow-casting state alters the number of active shadow
93626
+ // maps, so every material must recompile its shader.
93627
+
93628
+ Scene$1.updateChildren();
92767
93629
  }
92768
93630
  }, {
92769
93631
  key: "getCastShadow",
@@ -94398,6 +95260,27 @@ let Sky = /*#__PURE__*/function (_Element) {
94398
95260
  sound.detune(soundData.detune);
94399
95261
  }
94400
95262
  }
95263
+ }, {
95264
+ key: "completeParticleCreation",
95265
+ value: async function completeParticleCreation(emitter, particleData, options) {
95266
+ Importer.completeCommonCreationSteps(emitter, particleData, { ...options,
95267
+ skipOpacity: true
95268
+ }); // Load particle texture if one was saved
95269
+
95270
+ const particleOptions = particleData.options || {};
95271
+
95272
+ if (particleOptions.texture && particleOptions.textureAssetPath) {
95273
+ try {
95274
+ await Images$1.loadAssetByPath(particleOptions.textureAssetPath, particleOptions.texture, Images$1.currentLevel); // Rebuild so the texture is applied to the particle system
95275
+
95276
+ if (emitter.rebuild) {
95277
+ emitter.rebuild();
95278
+ }
95279
+ } catch (error) {
95280
+ console.warn("[Mage] Failed to load particle texture:", particleOptions.textureAssetPath, error);
95281
+ }
95282
+ }
95283
+ }
94401
95284
  }, {
94402
95285
  key: "parseLevelData",
94403
95286
  value: async function parseLevelData() {
@@ -94408,7 +95291,8 @@ let Sky = /*#__PURE__*/function (_Element) {
94408
95291
  lights = [],
94409
95292
  audio = [],
94410
95293
  sounds = [],
94411
- cameras = []
95294
+ cameras = [],
95295
+ particles = []
94412
95296
  } = data; // Support both 'audio' and 'sounds' keys for backwards compatibility
94413
95297
 
94414
95298
  const allSounds = [...audio, ...sounds]; // Process cameras - create game camera entity and apply settings to scene camera
@@ -94607,6 +95491,29 @@ let Sky = /*#__PURE__*/function (_Element) {
94607
95491
  } catch (error) {
94608
95492
  console.error(IMPORTER_ERROR_SOUND_CREATION, data.name, data.entitySubType, error.stack);
94609
95493
  }
95494
+ }); // processing particles
95495
+
95496
+ particles.forEach(data => {
95497
+ try {
95498
+ const particleOptions = data.options || {};
95499
+ const {
95500
+ preset
95501
+ } = data;
95502
+
95503
+ if (!preset) {
95504
+ console.warn(IMPORTER_ERROR_UNKNOWN_ELEMENT_SUBTYPE, data.entitySubType);
95505
+ return;
95506
+ }
95507
+
95508
+ const emitter = Particles$1.add(preset, particleOptions);
95509
+
95510
+ if (emitter) {
95511
+ emitter.setSceneEmitter(true);
95512
+ Importer.completeParticleCreation(emitter, data, options);
95513
+ }
95514
+ } catch (error) {
95515
+ console.error(IMPORTER_ERROR_PARTICLE_CREATION, data.name, data.preset, error.stack);
95516
+ }
94610
95517
  });
94611
95518
  }
94612
95519
  }]);
@@ -98516,4 +99423,4 @@ var Shaders$1 = new Shaders();let Shader = function Shader(name, attributes, uni
98516
99423
  ...light_contants,
98517
99424
  ...material_constants,
98518
99425
  ...controls_contants
98519
- };export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,CONTROL_EVENTS,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,Exporter,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HelperSprite,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Importer,Input$1 as Input,Label,LabelComponent,Level,Lights$1 as Lights,Line,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,index$1 as Partykals,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,Proton,ProtonParticleEmitter,Provider,Router$1 as Router,Scene$1 as Scene,Scripts$1 as Scripts,Shader,Sky,Skybox,Sound,Sphere,SpotLight,Sprite,Stats$1 as Stats,SunLight,three_module as THREE,THREEJS_CONTROL_EVENTS,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,map$1 as map,math,object,physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers,index$3 as xstate};
99426
+ };export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,CONTROL_EVENTS,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,Explosion,Exporter,FEATURES,Features$1 as Features,Fire,Fountain,GameRunner$1 as GameRunner,Grid,HelperSprite,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Importer,Input$1 as Input,Label,LabelComponent,Level,Lights$1 as Lights,Line,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,Proton,ProtonParticleEmitter,Provider,Rain,Router$1 as Router,Scene$1 as Scene,Scripts$1 as Scripts,Shader,Sky,Skybox,Snow,Sound,Sphere,SpotLight,Sprite,Stats$1 as Stats,SunLight,three_module as THREE,THREEJS_CONTROL_EVENTS,Trail,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,map$1 as map,math,object,physicsUtils,index$1 as rxjs,index as store,strings,uuid$1 as uuid,workers,index$2 as xstate};