mage-engine 3.19.0 → 3.20.2

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 +579 -402
  2. package/package.json +3 -3
package/dist/mage.js CHANGED
@@ -1,4 +1,4 @@
1
- function ownKeys$1(object, enumerableOnly) {
1
+ import Proton from'three.proton';export{default as Proton}from'three.proton';function ownKeys$1(object, enumerableOnly) {
2
2
  var keys = Object.keys(object);
3
3
 
4
4
  if (Object.getOwnPropertySymbols) {
@@ -24,14 +24,14 @@ function _objectSpread2$1(target) {
24
24
  return target;
25
25
  }
26
26
 
27
- function _typeof$1(obj) {
27
+ function _typeof(obj) {
28
28
  "@babel/helpers - typeof";
29
29
 
30
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
30
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
31
31
  return typeof obj;
32
32
  } : function (obj) {
33
33
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34
- }, _typeof$1(obj);
34
+ }, _typeof(obj);
35
35
  }
36
36
 
37
37
  function _classCallCheck(instance, Constructor) {
@@ -121,6 +121,23 @@ function _isNativeReflectConstruct() {
121
121
  }
122
122
  }
123
123
 
124
+ function _construct(Parent, args, Class) {
125
+ if (_isNativeReflectConstruct()) {
126
+ _construct = Reflect.construct;
127
+ } else {
128
+ _construct = function _construct(Parent, args, Class) {
129
+ var a = [null];
130
+ a.push.apply(a, args);
131
+ var Constructor = Function.bind.apply(Parent, a);
132
+ var instance = new Constructor();
133
+ if (Class) _setPrototypeOf(instance, Class.prototype);
134
+ return instance;
135
+ };
136
+ }
137
+
138
+ return _construct.apply(null, arguments);
139
+ }
140
+
124
141
  function _objectWithoutPropertiesLoose(source, excluded) {
125
142
  if (source == null) return {};
126
143
  var target = {};
@@ -354,22 +371,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
354
371
  }
355
372
  }
356
373
  };
357
- }var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
358
-
359
- function getAugmentedNamespace(n) {
360
- if (n.__esModule) return n;
361
- var a = Object.defineProperty({}, '__esModule', {value: true});
362
- Object.keys(n).forEach(function (k) {
363
- var d = Object.getOwnPropertyDescriptor(n, k);
364
- Object.defineProperty(a, k, d.get ? d : {
365
- enumerable: true,
366
- get: function () {
367
- return n[k];
368
- }
369
- });
370
- });
371
- return a;
372
- }var between = {exports: {}};/* Between.js v0.1.2-fix.2 */
374
+ }var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};var between = {exports: {}};/* Between.js v0.1.2-fix.2 */
373
375
 
374
376
  (function (module, exports) {
375
377
  !function(t,n){module.exports=n();}(commonjsGlobal,function(){function O(t){return (O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r);}}function n(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}function M(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function I(t){return (I=Object.getPrototypeOf||function(t){return t.__proto__})(t)}function o(t,n){return (o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,e){return (u="undefined"!=typeof Reflect&&Reflect.construct?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var u=new(t.bind.apply(t,r));return e&&o(u,e.prototype),u}).apply(null,arguments)}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var t=function(o){var a={},i=[];(o=o||this).on=function(t,n,e){return (a[t]=a[t]||[]).push([n,e]),o},o.off=function(t,n){t||(a={});for(var e=a[t]||i,r=e.length=n?e.length:0;r--;)n==e[r][0]&&e.splice(r,1);return o},o.emit=function(t){for(var n,e=a[t]||i,r=0<e.length?e.slice(0,e.length):e,u=0;n=r[u++];)n[0].apply(n[1],i.slice.call(arguments,1));return o};};var V=function(t,n,e){return t*(1-e)+n*e},e="undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function a(t,n){return t(n={exports:{}},n.exports),n.exports}for(var i=a(function(t){var n=t.exports={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return (t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return --t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return (t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return --t*t*t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return (t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4))},Out:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/.4)+1)},InOut:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(t){return t*t*(2.70158*t-1.70158)},Out:function(t){return --t*t*(2.70158*t+1.70158)+1},InOut:function(t){var n=2.5949095;return (t*=2)<1?t*t*((n+1)*t-n)*.5:.5*((t-=2)*t*((n+1)*t+n)+2)}},Bounce:{In:function(t){return 1-n.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*n.Bounce.In(2*t):.5*n.Bounce.Out(2*t-1)+.5}}};}),c=(i.Linear,i.Quadratic,i.Cubic,i.Quartic,i.Quintic,i.Sinusoidal,i.Exponential,i.Circular,i.Elastic,i.Back,i.Bounce,a(function(a){(function(){var t,n,e,r,u,o;"undefined"!=typeof performance&&null!==performance&&performance.now?a.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(a.exports=function(){return (t()-u)/1e6},n=process.hrtime,r=(t=function(){var t;return 1e9*(t=n())[0]+t[1]})(),o=1e9*process.uptime(),u=r-o):Date.now?(a.exports=function(){return Date.now()-e},e=Date.now()):(a.exports=function(){return (new Date).getTime()-e},e=(new Date).getTime());}).call(e);})),l="undefined"==typeof window?e:window,f=["moz","webkit"],s="AnimationFrame",p=l["request"+s],h=l["cancel"+s]||l["cancelRequest"+s],m=0;!p&&m<f.length;m++)p=l[f[m]+"Request"+s],h=l[f[m]+"Cancel"+s]||l[f[m]+"CancelRequest"+s];if(!p||!h){var d=0,y=0,v=[];p=function(t){if(0===v.length){var n=c(),e=Math.max(0,1e3/60-(n-d));d=e+n,setTimeout(function(){for(var t=v.slice(0),n=v.length=0;n<t.length;n++)if(!t[n].cancelled)try{t[n].callback(d);}catch(t){setTimeout(function(){throw t},0);}},Math.round(e));}return v.push({handle:++y,callback:t,cancelled:!1}),y},h=function(t){for(var n=0;n<v.length;n++)v[n].handle===t&&(v[n].cancelled=!0);};}var b=function(t){return p.call(l,t)};b.cancel=function(){h.apply(l,arguments);},b.polyfill=function(t){t||(t=l),t.requestAnimationFrame=p,t.cancelAnimationFrame=h;};var w,k,P=[],T=Symbol("type"),j=Symbol("start_time"),x=Symbol("completed"),D=Symbol("paused"),g=requestAnimationFrame||b,A=Date.now();!function t(){g(t),w=Date.now(),k=w-A;for(var n=0;n<P.length;n++)P[n][x]||P[n](k,Date.now()-P[n][j]);A=w;}();var E=function(t){function g(e,t){var n,r,u,o;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,g),u=this,o=I(g).call(this),M(_(_(r=!o||"object"!=typeof o&&"function"!=typeof o?_(u):o)),"update",function(){var e=_(_(r))._updateValue;return function(t,n){r[x]||r[D]||(0===r.localTime&&r.emit("start",r.value,_(_(r))),e(r.ease(r.loopFunction.progress(Math.min(1,(n||r.localTime)/r.duration)))),r.emit("update",r.value,_(_(r)),t),r.localTime>=r.duration&&r.loopFunction.complete(function(){r[x]=!0,r.emit("complete",r.value,_(_(r)));}),r.localTime+=t);}});var a=r.plugin=Object.values(g._plugins).reduce(function(t,n){return t||n&&n.test&&n.test(e)&&n},!1),i=a&&a.name||("object"===O(e)?Array.isArray(e)?"array":"object":"number");if(a){var c=a.initialize(e,t);e=c.startValue,t=c.destValue,r.data=c.data;}switch(Object.assign(_(_(r)),(M(n={duration:1e3,localTime:0,startValue:e,destValue:t,loopMode:"once",loopFunction:g.DEFAULT_LOOP,ease:function(t){return t},value:"array"===i?[].concat(e):"object"===i?Object.assign({},e):e},x,!1),M(n,T,i),M(n,j,Date.now()),M(n,D,!1),n)),r[T]){case"number":r._updateValue=function(t){r.value=V(r.startValue,r.destValue,t);};break;case"array":var l=r.value.length,f=_(_(r)),s=f.startValue,p=f.destValue,h=f.value;r._updateValue=function(t){for(var n=0;n<l;n++)h[n]=V(s[n],p[n],t);};break;case"object":var m=Object.keys(r.startValue),d=m.length,y=_(_(r)),v=y.startValue,b=y.destValue,w=y.value;r._updateValue=function(t){for(var n=0;n<d;n++){var e=m[n];w[e]=V(v[e],b[e],t);}};break;default:r.plugin?r._updateValue=function(t){r.value=r.plugin.interpolate(r.startValue,r.destValue,t,r.data);}:(console.warn("Between: startValue type was unrecognized."),r._updateValue=function(){return null});}return P.push(r.update()),r}return n(g,null,[{key:"between",value:function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return u(g,n)}}]),n(g,[{key:"pause",value:function(){return this[D]=!0,this.emit("pause",this.value,this,k),this}},{key:"play",value:function(){return this[D]=!1,this.emit("play",this.value,this,k),this}},{key:"easing",value:function(t){return this.ease=t,this}},{key:"time",value:function(t){return this.duration=t,this}},{key:"loop",value:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"once",n="__loop_".concat(t),e=arguments.length,r=new Array(1<e?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];return this.loopFunction=n in this?Object.assign({},g.DEFAULT_LOOP,this[n].apply(this,r)):g.DEFAULT_LOOP,this}},{key:"__loop_repeat",value:function(t){var n=this,e=t;return this.times=0,{complete:function(t){n.localTime=0,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;}}}},{key:"__loop_bounce",value:function(t){var n=this,e=t,r=1;return this.times=0,{complete:function(t){n.localTime=0,r=-r,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;},progress:function(t){return 0<r?t:1-t}}}},{key:"isPaused",get:function(){return this[D]}}]),function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");o(t.prototype,n&&n.prototype),n&&o(t,n);}(g,t),g}(t);return M(E,"DEFAULT_LOOP",{complete:function(t){return t()},progress:function(t){return t}}),E.Easing=i,E._plugins={},E});
@@ -53661,7 +53663,7 @@ var LABEL_DOMELEMENT_MISSING = "".concat(PREFIX, " Could not create Label, domEl
53661
53663
  function BaseScript(name) {
53662
53664
  _classCallCheck(this, BaseScript);
53663
53665
 
53664
- this.__name = name || this.contructor.name;
53666
+ this.__name = name || this.constructor.name;
53665
53667
  this.hasStarted = false;
53666
53668
  this.options = {};
53667
53669
  }
@@ -53693,35 +53695,20 @@ var LABEL_DOMELEMENT_MISSING = "".concat(PREFIX, " Could not create Label, domEl
53693
53695
  }]);
53694
53696
 
53695
53697
  return BaseScript;
53696
- }();/*!
53697
- * hotkeys-js v3.7.2
53698
- * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
53699
- *
53700
- * Copyright (c) 2019 kenny wong <wowohoo@qq.com>
53701
- * http://jaywcjlove.github.io/hotkeys
53698
+ }();/**!
53699
+ * hotkeys-js v3.9.4
53700
+ * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
53702
53701
  *
53703
- * Licensed under the MIT license.
53702
+ * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
53703
+ * http://jaywcjlove.github.io/hotkeys
53704
+ * Licensed under the MIT license
53704
53705
  */
53705
53706
 
53706
- function _typeof(obj) {
53707
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
53708
- _typeof = function (obj) {
53709
- return typeof obj;
53710
- };
53711
- } else {
53712
- _typeof = function (obj) {
53713
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
53714
- };
53715
- }
53716
-
53717
- return _typeof(obj);
53718
- }
53719
-
53720
53707
  var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
53721
53708
 
53722
- function addEvent(object, event, method) {
53709
+ function addEvent(object, event, method, useCapture) {
53723
53710
  if (object.addEventListener) {
53724
- object.addEventListener(event, method, false);
53711
+ object.addEventListener(event, method, useCapture);
53725
53712
  } else if (object.attachEvent) {
53726
53713
  object.attachEvent("on".concat(event), function () {
53727
53714
  method(window.event);
@@ -53776,7 +53763,7 @@ var _keyMap = {
53776
53763
  tab: 9,
53777
53764
  clear: 12,
53778
53765
  enter: 13,
53779
- "return": 13,
53766
+ return: 13,
53780
53767
  esc: 27,
53781
53768
  escape: 27,
53782
53769
  space: 32,
@@ -53785,7 +53772,7 @@ var _keyMap = {
53785
53772
  right: 39,
53786
53773
  down: 40,
53787
53774
  del: 46,
53788
- "delete": 46,
53775
+ delete: 46,
53789
53776
  ins: 45,
53790
53777
  insert: 45,
53791
53778
  home: 36,
@@ -53793,6 +53780,22 @@ var _keyMap = {
53793
53780
  pageup: 33,
53794
53781
  pagedown: 34,
53795
53782
  capslock: 20,
53783
+ num_0: 96,
53784
+ num_1: 97,
53785
+ num_2: 98,
53786
+ num_3: 99,
53787
+ num_4: 100,
53788
+ num_5: 101,
53789
+ num_6: 102,
53790
+ num_7: 103,
53791
+ num_8: 104,
53792
+ num_9: 105,
53793
+ num_multiply: 106,
53794
+ num_add: 107,
53795
+ num_enter: 108,
53796
+ num_subtract: 109,
53797
+ num_decimal: 110,
53798
+ num_divide: 111,
53796
53799
  '⇪': 20,
53797
53800
  ',': 188,
53798
53801
  '.': 190,
@@ -53848,6 +53851,8 @@ for (var k$1 = 1; k$1 < 20; k$1++) {
53848
53851
 
53849
53852
  var _downKeys = []; // 记录摁下的绑定键
53850
53853
 
53854
+ var winListendFocus = false; // window是否已经监听了focus事件
53855
+
53851
53856
  var _scope = 'all'; // 默认热键范围
53852
53857
 
53853
53858
  var elementHasBindEvent = []; // 已绑定事件的节点记录
@@ -53879,7 +53884,7 @@ function filter$1(event) {
53879
53884
  var tagName = target.tagName;
53880
53885
  var flag = true; // ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
53881
53886
 
53882
- if (target.isContentEditable || tagName === 'TEXTAREA' || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) {
53887
+ if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT') && !target.readOnly) {
53883
53888
  flag = false;
53884
53889
  }
53885
53890
 
@@ -53946,7 +53951,7 @@ function clearModifier(event) {
53946
53951
 
53947
53952
  function unbind(keysInfo) {
53948
53953
  // unbind(), unbind all keys
53949
- if (!keysInfo) {
53954
+ if (typeof keysInfo === 'undefined') {
53950
53955
  Object.keys(_handlers).forEach(function (key) {
53951
53956
  return delete _handlers[key];
53952
53957
  });
@@ -53955,7 +53960,7 @@ function unbind(keysInfo) {
53955
53960
  keysInfo.forEach(function (info) {
53956
53961
  if (info.key) eachUnbind(info);
53957
53962
  });
53958
- } else if (_typeof(keysInfo) === 'object') {
53963
+ } else if (typeof keysInfo === 'object') {
53959
53964
  // support like unbind({key: 'ctrl+a, ctrl+b', scope:'abc'})
53960
53965
  if (keysInfo.key) eachUnbind(keysInfo);
53961
53966
  } else if (typeof keysInfo === 'string') {
@@ -53999,21 +54004,20 @@ var eachUnbind = function eachUnbind(_ref) {
53999
54004
 
54000
54005
  if (!scope) scope = getScope();
54001
54006
  var mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
54002
- _handlers[keyCode] = _handlers[keyCode].map(function (record) {
54007
+ _handlers[keyCode] = _handlers[keyCode].filter(function (record) {
54003
54008
  // 通过函数判断,是否解除绑定,函数相等直接返回
54004
54009
  var isMatchingMethod = method ? record.method === method : true;
54005
-
54006
- if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) {
54007
- return {};
54008
- }
54009
-
54010
- return record;
54010
+ return !(isMatchingMethod && record.scope === scope && compareArray(record.mods, mods));
54011
54011
  });
54012
54012
  });
54013
54013
  }; // 对监听对应快捷键的回调函数进行处理
54014
54014
 
54015
54015
 
54016
- function eventHandler(event, handler, scope) {
54016
+ function eventHandler(event, handler, scope, element) {
54017
+ if (handler.element !== element) {
54018
+ return;
54019
+ }
54020
+
54017
54021
  var modifiersMatch; // 看它是否在当前范围
54018
54022
 
54019
54023
  if (handler.scope === scope || handler.scope === 'all') {
@@ -54040,7 +54044,7 @@ function eventHandler(event, handler, scope) {
54040
54044
  } // 处理keydown事件
54041
54045
 
54042
54046
 
54043
- function dispatch$9(event) {
54047
+ function dispatch$9(event, element) {
54044
54048
  var asterisk = _handlers['*'];
54045
54049
  var key = event.keyCode || event.which || event.charCode; // 表单控件过滤 默认表单控件不触发快捷键
54046
54050
 
@@ -54068,6 +54072,14 @@ function dispatch$9(event) {
54068
54072
  _downKeys.push(keyNum);
54069
54073
  } else if (!event[keyName] && _downKeys.indexOf(keyNum) > -1) {
54070
54074
  _downKeys.splice(_downKeys.indexOf(keyNum), 1);
54075
+ } else if (keyName === 'metaKey' && event[keyName] && _downKeys.length === 3) {
54076
+ /**
54077
+ * Fix if Command is pressed:
54078
+ * ===============================
54079
+ */
54080
+ if (!(event.ctrlKey || event.shiftKey || event.altKey)) {
54081
+ _downKeys = _downKeys.slice(_downKeys.indexOf(keyNum));
54082
+ }
54071
54083
  }
54072
54084
  });
54073
54085
  /**
@@ -54089,6 +54101,26 @@ function dispatch$9(event) {
54089
54101
  if (Object.prototype.hasOwnProperty.call(_mods, e)) {
54090
54102
  _mods[e] = event[modifierMap[e]];
54091
54103
  }
54104
+ }
54105
+ /**
54106
+ * https://github.com/jaywcjlove/hotkeys/pull/129
54107
+ * This solves the issue in Firefox on Windows where hotkeys corresponding to special characters would not trigger.
54108
+ * An example of this is ctrl+alt+m on a Swedish keyboard which is used to type μ.
54109
+ * Browser support: https://caniuse.com/#feat=keyboardevent-getmodifierstate
54110
+ */
54111
+
54112
+
54113
+ if (event.getModifierState && !(event.altKey && !event.ctrlKey) && event.getModifierState('AltGraph')) {
54114
+ if (_downKeys.indexOf(17) === -1) {
54115
+ _downKeys.push(17);
54116
+ }
54117
+
54118
+ if (_downKeys.indexOf(18) === -1) {
54119
+ _downKeys.push(18);
54120
+ }
54121
+
54122
+ _mods[17] = true;
54123
+ _mods[18] = true;
54092
54124
  } // 获取范围 默认为 `all`
54093
54125
 
54094
54126
 
@@ -54097,7 +54129,7 @@ function dispatch$9(event) {
54097
54129
  if (asterisk) {
54098
54130
  for (var i = 0; i < asterisk.length; i++) {
54099
54131
  if (asterisk[i].scope === scope && (event.type === 'keydown' && asterisk[i].keydown || event.type === 'keyup' && asterisk[i].keyup)) {
54100
- eventHandler(event, asterisk[i], scope);
54132
+ eventHandler(event, asterisk[i], scope, element);
54101
54133
  }
54102
54134
  }
54103
54135
  } // key 不在 _handlers 中返回
@@ -54119,7 +54151,7 @@ function dispatch$9(event) {
54119
54151
 
54120
54152
  if (_downKeysCurrent.sort().join('') === _downKeys.sort().join('')) {
54121
54153
  // 找到处理内容
54122
- eventHandler(event, record, scope);
54154
+ eventHandler(event, record, scope, element);
54123
54155
  }
54124
54156
  }
54125
54157
  }
@@ -54143,7 +54175,8 @@ function hotkeys(key, option, method) {
54143
54175
  var i = 0;
54144
54176
  var keyup = false;
54145
54177
  var keydown = true;
54146
- var splitKey = '+'; // 对为设定范围的判断
54178
+ var splitKey = '+';
54179
+ var capture = false; // 对为设定范围的判断
54147
54180
 
54148
54181
  if (method === undefined && typeof option === 'function') {
54149
54182
  method = option;
@@ -54158,6 +54191,8 @@ function hotkeys(key, option, method) {
54158
54191
 
54159
54192
  if (option.keydown !== undefined) keydown = option.keydown; // eslint-disable-line
54160
54193
 
54194
+ if (option.capture !== undefined) capture = option.capture; // eslint-disable-line
54195
+
54161
54196
  if (typeof option.splitKey === 'string') splitKey = option.splitKey; // eslint-disable-line
54162
54197
  }
54163
54198
 
@@ -54184,7 +54219,8 @@ function hotkeys(key, option, method) {
54184
54219
  shortcut: keys[i],
54185
54220
  method: method,
54186
54221
  key: keys[i],
54187
- splitKey: splitKey
54222
+ splitKey: splitKey,
54223
+ element: element
54188
54224
  });
54189
54225
  } // 在全局document上设置快捷键
54190
54226
 
@@ -54192,18 +54228,36 @@ function hotkeys(key, option, method) {
54192
54228
  if (typeof element !== 'undefined' && !isElementBind(element) && window) {
54193
54229
  elementHasBindEvent.push(element);
54194
54230
  addEvent(element, 'keydown', function (e) {
54195
- dispatch$9(e);
54196
- });
54197
- addEvent(window, 'focus', function () {
54198
- _downKeys = [];
54199
- });
54231
+ dispatch$9(e, element);
54232
+ }, capture);
54233
+
54234
+ if (!winListendFocus) {
54235
+ winListendFocus = true;
54236
+ addEvent(window, 'focus', function () {
54237
+ _downKeys = [];
54238
+ }, capture);
54239
+ }
54240
+
54200
54241
  addEvent(element, 'keyup', function (e) {
54201
- dispatch$9(e);
54242
+ dispatch$9(e, element);
54202
54243
  clearModifier(e);
54203
- });
54244
+ }, capture);
54204
54245
  }
54205
54246
  }
54206
54247
 
54248
+ function trigger(shortcut) {
54249
+ var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
54250
+ Object.keys(_handlers).forEach(function (key) {
54251
+ var data = _handlers[key].find(function (item) {
54252
+ return item.scope === scope && item.shortcut === shortcut;
54253
+ });
54254
+
54255
+ if (data && data.method) {
54256
+ data.method();
54257
+ }
54258
+ });
54259
+ }
54260
+
54207
54261
  var _api = {
54208
54262
  setScope: setScope,
54209
54263
  getScope: getScope,
@@ -54211,7 +54265,11 @@ var _api = {
54211
54265
  getPressedKeyCodes: getPressedKeyCodes,
54212
54266
  isPressed: isPressed,
54213
54267
  filter: filter$1,
54214
- unbind: unbind
54268
+ trigger: trigger,
54269
+ unbind: unbind,
54270
+ keyMap: _keyMap,
54271
+ modifier: _modifier,
54272
+ modifierMap: modifierMap
54215
54273
  };
54216
54274
 
54217
54275
  for (var a in _api) {
@@ -54294,18 +54352,23 @@ var Keyboard = /*#__PURE__*/function (_EventDispatcher) {
54294
54352
  }, {
54295
54353
  key: "enable",
54296
54354
  value: function enable() {
54355
+ var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (f) {
54356
+ return f;
54357
+ };
54297
54358
  this.enabled = true;
54298
- window.addEventListener(KEY_DOWN, this.handleKeydown.bind(this));
54299
- window.addEventListener(KEY_UP, this.handleKeyup.bind(this));
54300
- window.addEventListener(KEY_PRESS, this.handleKeypress.bind(this));
54359
+ this.register('*', cb);
54360
+ window.addEventListener(KEY_DOWN.toLowerCase(), this.handleKeydown.bind(this));
54361
+ window.addEventListener(KEY_UP.toLowerCase(), this.handleKeyup.bind(this));
54362
+ window.addEventListener(KEY_PRESS.toLowerCase(), this.handleKeypress.bind(this));
54301
54363
  }
54302
54364
  }, {
54303
54365
  key: "disable",
54304
54366
  value: function disable() {
54305
54367
  this.enabled = false;
54306
- window.removeEventListener(KEY_DOWN, this.handleKeydown.bind(this));
54307
- window.removeEventListener(KEY_UP, this.handleKeyup.bind(this));
54308
- window.removeEventListener(KEY_PRESS, this.handleKeypress.bind(this));
54368
+ hotkeys.unbind();
54369
+ window.removeEventListener(KEY_DOWN.toLowerCase(), this.handleKeydown.bind(this));
54370
+ window.removeEventListener(KEY_UP.toLowerCase(), this.handleKeyup.bind(this));
54371
+ window.removeEventListener(KEY_PRESS.toLowerCase(), this.handleKeypress.bind(this));
54309
54372
  }
54310
54373
  }, {
54311
54374
  key: "isPressed",
@@ -54363,9 +54426,9 @@ var createElementFromSelector = function createElementFromSelector(selector) {
54363
54426
  } catch (e) {
54364
54427
  return null;
54365
54428
  }
54366
- };var DEFAULT_HEIGHT$1 = 600;
54429
+ };var DEFAULT_HEIGHT$2 = 600;
54367
54430
  var DEFAULT_WIDTH = 800;
54368
- var DEFAULT_RATIO = DEFAULT_WIDTH / DEFAULT_HEIGHT$1;
54431
+ var DEFAULT_RATIO = DEFAULT_WIDTH / DEFAULT_HEIGHT$2;
54369
54432
 
54370
54433
  var Config = /*#__PURE__*/function () {
54371
54434
  function Config() {
@@ -54483,7 +54546,7 @@ var Config = /*#__PURE__*/function () {
54483
54546
  key: "getScreenDefaults",
54484
54547
  value: function getScreenDefaults() {
54485
54548
  return {
54486
- h: DEFAULT_HEIGHT$1,
54549
+ h: DEFAULT_HEIGHT$2,
54487
54550
  w: DEFAULT_WIDTH,
54488
54551
  ratio: DEFAULT_RATIO
54489
54552
  };
@@ -55937,7 +56000,7 @@ var DEFAULT_TAG = 'all';var Scene = /*#__PURE__*/function () {
55937
56000
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : generateRandomName('LevelName');
55938
56001
  var fog = Config$1.fog();
55939
56002
  this.scene = new Scene$2();
55940
- this.scene.name = name; // this.scene.overrideMaterial = null; // should be null by default, but it's not.
56003
+ this.scene.name = name;
55941
56004
 
55942
56005
  if (fog.enabled) {
55943
56006
  this.fog(fog.color, fog.density);
@@ -57333,7 +57396,7 @@ function applyMiddleware() {
57333
57396
 
57334
57397
  var thunk = createThunkMiddleware();
57335
57398
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
57336
- var version$1 = "3.19.0";
57399
+ var version$1 = "3.20.2";
57337
57400
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
57338
57401
  var main = "dist/mage.js";
57339
57402
  var author$1 = {
@@ -57375,7 +57438,7 @@ var dependencies = {
57375
57438
  "@babel/plugin-transform-runtime": "7.5.0",
57376
57439
  "@babel/runtime": "7.5.0",
57377
57440
  "between.js": "0.1.2-fix.2",
57378
- "hotkeys-js": "3.7.2",
57441
+ "hotkeys-js": "3.9.4",
57379
57442
  "html-to-image": "^1.9.0",
57380
57443
  html2canvas: "^1.4.1",
57381
57444
  inferno: "7.3.2",
@@ -57386,7 +57449,7 @@ var dependencies = {
57386
57449
  "redux-thunk": "^2.3.0",
57387
57450
  rxjs: "6.5.3",
57388
57451
  three: "0.126.0",
57389
- "three.proton.js": "0.2.3",
57452
+ "three.proton": "npm:three.proton.js@0.2.3",
57390
57453
  vivifyjs: "*",
57391
57454
  "whatwg-fetch": "3.0.0",
57392
57455
  xstate: "^4.8.0"
@@ -58602,7 +58665,7 @@ if (!self.fetch) {
58602
58665
  self.Headers = Headers;
58603
58666
  self.Request = Request;
58604
58667
  self.Response = Response;
58605
- }var _excluded$7 = ["wheels", "accelerationKey", "brakingKey", "rightKey", "leftKey", "debug"];
58668
+ }var _excluded$7 = ["wheels", "accelerationKey", "brakingKey", "rightKey", "leftKey", "debug", "autostart"];
58606
58669
 
58607
58670
  var BaseCar = /*#__PURE__*/function (_BaseScript) {
58608
58671
  _inherits(BaseCar, _BaseScript);
@@ -58628,7 +58691,9 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
58628
58691
  _options$leftKey = options.leftKey,
58629
58692
  leftKey = _options$leftKey === void 0 ? 'a' : _options$leftKey;
58630
58693
  options.debug;
58631
- var physicsOptions = _objectWithoutProperties(options, _excluded$7);
58694
+ var _options$autostart = options.autostart,
58695
+ autostart = _options$autostart === void 0 ? true : _options$autostart,
58696
+ physicsOptions = _objectWithoutProperties(options, _excluded$7);
58632
58697
 
58633
58698
  this.car = element;
58634
58699
  this.wheels = wheels;
@@ -58642,6 +58707,7 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
58642
58707
  this.brakingKey = brakingKey;
58643
58708
  this.rightKey = rightKey;
58644
58709
  this.leftKey = leftKey;
58710
+ this.engineStarted = autostart;
58645
58711
  Input$1.enable();
58646
58712
  Physics$1.addVehicle(this.car, _objectSpread2$1({
58647
58713
  wheels: wheels.map(function (w) {
@@ -58649,6 +58715,16 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
58649
58715
  })
58650
58716
  }, physicsOptions));
58651
58717
  }
58718
+ }, {
58719
+ key: "startEngine",
58720
+ value: function startEngine() {
58721
+ this.engineStarted = true;
58722
+ }
58723
+ }, {
58724
+ key: "stopEngine",
58725
+ value: function stopEngine() {
58726
+ this.engineStarted = false;
58727
+ }
58652
58728
  }, {
58653
58729
  key: "handleInput",
58654
58730
  value: function handleInput() {
@@ -58665,14 +58741,16 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
58665
58741
  }, {
58666
58742
  key: "update",
58667
58743
  value: function update(dt) {
58668
- this.handleInput();
58669
- this.sendCarUpdate();
58744
+ if (this.engineStarted) {
58745
+ this.handleInput();
58746
+ this.sendCarUpdate();
58747
+ }
58670
58748
  }
58671
58749
  }]);
58672
58750
 
58673
58751
  return BaseCar;
58674
58752
  }(BaseScript);var DEFAULT_DISTANCE$1 = 5.0;
58675
- var DEFAULT_HEIGHT = 3.0;
58753
+ var DEFAULT_HEIGHT$1 = 3.0;
58676
58754
  var DEFAULT_HEIGHT_DAMPING = 2.0;
58677
58755
  var DEFAULT_LOOK_AT_HEIGHT = 1;
58678
58756
  var DEFAULT_ROTATION_SNAP_TIME = 0.3;
@@ -58695,7 +58773,7 @@ var SmoothCarFollow = /*#__PURE__*/function (_BaseScript) {
58695
58773
  value: function start(camera, options) {
58696
58774
  var target = options.target,
58697
58775
  _options$height = options.height,
58698
- height = _options$height === void 0 ? DEFAULT_HEIGHT : _options$height,
58776
+ height = _options$height === void 0 ? DEFAULT_HEIGHT$1 : _options$height,
58699
58777
  _options$heightDampin = options.heightDamping,
58700
58778
  heightDamping = _options$heightDampin === void 0 ? DEFAULT_HEIGHT_DAMPING : _options$heightDampin,
58701
58779
  _options$lookAtHeight = options.lookAtHeight,
@@ -58707,7 +58785,8 @@ var SmoothCarFollow = /*#__PURE__*/function (_BaseScript) {
58707
58785
  _options$distanceSnap = options.distanceSnapTime,
58708
58786
  distanceSnapTime = _options$distanceSnap === void 0 ? DEFAULT_DISTANCE_SNAP_TIME : _options$distanceSnap,
58709
58787
  _options$distanceMult = options.distanceMultiplier,
58710
- distanceMultiplier = _options$distanceMult === void 0 ? DEFAULT_DISTANCE_MULTIPLIER : _options$distanceMult;
58788
+ distanceMultiplier = _options$distanceMult === void 0 ? DEFAULT_DISTANCE_MULTIPLIER : _options$distanceMult,
58789
+ lerpFactor = options.lerpFactor;
58711
58790
  this.camera = camera;
58712
58791
  this.target = target;
58713
58792
  this.height = height;
@@ -58716,6 +58795,7 @@ var SmoothCarFollow = /*#__PURE__*/function (_BaseScript) {
58716
58795
  this.rotationSnapTime = rotationSnapTime;
58717
58796
  this.distanceSnapTime = distanceSnapTime;
58718
58797
  this.distanceMultiplier = distanceMultiplier;
58798
+ this.lerpFactor = lerpFactor;
58719
58799
  this.lookAtVector = new Vector3$1(0, lookAtHeight, 0);
58720
58800
  }
58721
58801
  }, {
@@ -58731,9 +58811,9 @@ var SmoothCarFollow = /*#__PURE__*/function (_BaseScript) {
58731
58811
  var targetPosition = this.target.getPosition();
58732
58812
  var vector = new Vector3$1(x, y, z).negate().normalize().multiplyScalar(this.distance);
58733
58813
  vector.y = y + this.height;
58734
- var desiredPosition = targetPosition.add(vector); // const lerpFactor = 1 - Math.pow(0.1, dt);
58735
-
58736
- cameraPosition.lerpVectors(cameraPosition, desiredPosition, dt);
58814
+ var desiredPosition = targetPosition.add(vector);
58815
+ var lerpFactor = this.lerpFactor || 1 - Math.pow(0.1, dt);
58816
+ cameraPosition.lerpVectors(cameraPosition, desiredPosition, lerpFactor);
58737
58817
  this.camera.setPosition(cameraPosition);
58738
58818
  var lookAtTarget = new Vector3$1();
58739
58819
  lookAtTarget.copy(this.target.getPosition().add(this.lookAtVector));
@@ -58962,14 +59042,14 @@ var _bbox = new Box3();
58962
59042
 
58963
59043
  var _uniformArray = [];
58964
59044
  var _logArray = [];
58965
- var DEFAULT_MAX_FAR = 100000;
59045
+ var DEFAULT_MAX_FAR = 5000;
58966
59046
  var DEFAULT_MODE = 'practical';
58967
59047
  var DEFAULT_SHADOWMAP_SIZE = 2048;
58968
59048
  var DEFAULT_CASCADE = 3;
58969
59049
  var DEFAULT_BIAS$3 = 0.000001;
58970
59050
  var DEFAULT_INTENSITY$5 = 1;
58971
59051
  var DEFAULT_NEAR$3 = 1;
58972
- var DEFAULT_FAR$3 = 2000;
59052
+ var DEFAULT_FAR$3 = 1000;
58973
59053
  var DEFAULT_MARGIN = 200;
58974
59054
  var CascadeShadowMaps = /*#__PURE__*/function () {
58975
59055
  function CascadeShadowMaps(_ref) {
@@ -59304,33 +59384,30 @@ var CascadeShadowMaps = /*#__PURE__*/function () {
59304
59384
  }();var POINTLIGHT = 'pointlight';
59305
59385
  var AMBIENTLIGHT = 'ambientlight';
59306
59386
  var SUNLIGHT = 'sunlight';
59307
- var SPOTLIGHT = 'spotlight';
59308
- var HEMISPHERELIGHT = 'hemisphere';
59309
- var TIME_TO_UPDATE = 5;
59310
59387
  var Lights = /*#__PURE__*/function () {
59311
59388
  function Lights() {
59312
59389
  _classCallCheck(this, Lights);
59313
59390
 
59314
- this.delayFactor = 0.1;
59315
- this.delayStep = 30;
59316
- this.holderRadius = 0.01;
59317
- this.holderSegments = 1;
59318
- this.numLights = 0;
59319
- this.map = {};
59320
59391
  this.lights = [];
59321
59392
  this.csm = undefined;
59322
59393
  }
59323
59394
 
59324
59395
  _createClass(Lights, [{
59325
- key: "isUsingCSM",
59326
- value: function isUsingCSM() {
59396
+ key: "getLights",
59397
+ value: function getLights() {
59398
+ return this.lights;
59399
+ }
59400
+ }, {
59401
+ key: "isUsingCascadeShadowMaps",
59402
+ value: function isUsingCascadeShadowMaps() {
59327
59403
  return !!this.csm;
59328
59404
  }
59329
59405
  }, {
59330
- key: "setUpCSM",
59331
- value: function setUpCSM() {
59406
+ key: "createCascadeShadowMaps",
59407
+ value: function createCascadeShadowMaps() {
59332
59408
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
59333
59409
  this.csm = new CascadeShadowMaps(options);
59410
+ return this.csm;
59334
59411
  }
59335
59412
  }, {
59336
59413
  key: "add",
@@ -59340,17 +59417,9 @@ var Lights = /*#__PURE__*/function () {
59340
59417
  }, {
59341
59418
  key: "update",
59342
59419
  value: function update(dt) {
59343
- if (this.isUsingCSM()) {
59420
+ if (this.isUsingCascadeShadowMaps()) {
59344
59421
  this.csm.update();
59345
59422
  }
59346
-
59347
- var start = new Date();
59348
-
59349
- for (var index in this.lights) {
59350
- var light = this.lights[index];
59351
- light.update(dt);
59352
- if (+new Date() - start > TIME_TO_UPDATE) break;
59353
- }
59354
59423
  }
59355
59424
  }, {
59356
59425
  key: "toJSON",
@@ -59447,7 +59516,7 @@ var ToonMaterial = /*#__PURE__*/function (_ShaderMaterial) {
59447
59516
 
59448
59517
  if (hasMaterial(mesh)) {
59449
59518
  var setUpMaterial = function setUpMaterial(material) {
59450
- if (Lights$1.isUsingCSM()) {
59519
+ if (Lights$1.isUsingCascadeShadowMaps()) {
59451
59520
  Lights$1.csm.setupMaterial(material);
59452
59521
  }
59453
59522
 
@@ -59474,38 +59543,38 @@ var hasGeometry = function hasGeometry(mesh) {
59474
59543
  var processMaterial = function processMaterial(material, callback) {
59475
59544
  return Array.isArray(material) ? material.map(callback) : callback(material);
59476
59545
  };
59477
- var changeMaterialByName = function changeMaterialByName(name, mesh, materialOptions) {
59546
+ var replaceMaterialByName = function replaceMaterialByName(name, mesh, materialOptions) {
59478
59547
  if (!hasMaterial(mesh)) return;
59479
59548
 
59480
59549
  switch (name) {
59481
59550
  case MATERIALS.LAMBERT:
59482
- return cloneMaterial(MeshLambertMaterial, mesh, materialOptions);
59551
+ return replaceMaterial(MeshLambertMaterial, mesh, materialOptions);
59483
59552
 
59484
59553
  case MATERIALS.PHONG:
59485
- return cloneMaterial(MeshPhongMaterial, mesh, materialOptions);
59554
+ return replaceMaterial(MeshPhongMaterial, mesh, materialOptions);
59486
59555
 
59487
59556
  case MATERIALS.DEPTH:
59488
- return cloneMaterial(MeshDepthMaterial, mesh, materialOptions);
59557
+ return replaceMaterial(MeshDepthMaterial, mesh, materialOptions);
59489
59558
 
59490
59559
  case MATERIALS.STANDARD:
59491
- return cloneMaterial(MeshStandardMaterial, mesh, materialOptions);
59560
+ return replaceMaterial(MeshStandardMaterial, mesh, materialOptions);
59492
59561
 
59493
59562
  case MATERIALS.TOON:
59494
- return cloneMaterial(ToonMaterial, mesh, materialOptions);
59563
+ return replaceMaterial(ToonMaterial, mesh, materialOptions);
59495
59564
 
59496
59565
  case MATERIALS.THREE_TOON:
59497
- return cloneMaterial(MeshToonMaterial, mesh, materialOptions);
59566
+ return replaceMaterial(MeshToonMaterial, mesh, materialOptions);
59498
59567
 
59499
59568
  case MATERIALS.BASIC:
59500
59569
  default:
59501
- return cloneMaterial(MeshBasicMaterial, mesh, materialOptions);
59570
+ return replaceMaterial(MeshBasicMaterial, mesh, materialOptions);
59502
59571
  }
59503
59572
  };
59504
59573
 
59505
- var cloneMaterial = function cloneMaterial(MeshMaterial, mesh) {
59574
+ var replaceMaterial = function replaceMaterial(MeshMaterial, mesh) {
59506
59575
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
59507
59576
 
59508
- var _cloneMaterial = function _cloneMaterial(material) {
59577
+ var _replaceMaterial = function _replaceMaterial(material) {
59509
59578
  var clone = material.clone();
59510
59579
  var newMaterial = new MeshMaterial(_objectSpread2$1({
59511
59580
  map: clone.map,
@@ -59515,8 +59584,9 @@ var cloneMaterial = function cloneMaterial(MeshMaterial, mesh) {
59515
59584
  return newMaterial;
59516
59585
  };
59517
59586
 
59518
- mesh.material = processMaterial(mesh.material, _cloneMaterial);
59587
+ mesh.material = processMaterial(mesh.material, _replaceMaterial);
59519
59588
  setUpLightsAndShadows(mesh);
59589
+ return mesh.material;
59520
59590
  };
59521
59591
 
59522
59592
  var disposeTextures = function disposeTextures(mesh) {
@@ -59548,7 +59618,49 @@ var prepareModel = function prepareModel(model) {
59548
59618
  setUpLightsAndShadows(mesh);
59549
59619
  });
59550
59620
  return model;
59551
- };var Entity = /*#__PURE__*/function (_EventDispatcher) {
59621
+ };var LOOPING = {
59622
+ BOUNCE: 'bounce',
59623
+ REPEAT: 'repeat',
59624
+ NONE: false
59625
+ };
59626
+ var EASING_EVENTS = {
59627
+ UPDATE: 'update',
59628
+ COMPLETE: 'complete'
59629
+ };
59630
+ var FUNCTIONS = _objectSpread2$1({}, Between.Easing);
59631
+ var tweenTo = function tweenTo(origin, target) {
59632
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
59633
+ return new Promise(function (resolve) {
59634
+ var time = options.time,
59635
+ _options$easing = options.easing,
59636
+ easing = _options$easing === void 0 ? FUNCTIONS.Linear.None : _options$easing,
59637
+ _options$loop = options.loop,
59638
+ loop = _options$loop === void 0 ? LOOPING.NONE : _options$loop,
59639
+ _options$onUpdate = options.onUpdate,
59640
+ onUpdate = _options$onUpdate === void 0 ? function (f) {
59641
+ return f;
59642
+ } : _options$onUpdate,
59643
+ _options$repeat = options.repeat,
59644
+ repeat = _options$repeat === void 0 ? undefined : _options$repeat;
59645
+ var tween = new Between(origin, target).time(time).easing(easing).on(EASING_EVENTS.UPDATE, onUpdate);
59646
+ var infinite = loop && !repeat;
59647
+
59648
+ var onComplete = function onComplete() {
59649
+ return resolve(tween, infinite);
59650
+ };
59651
+
59652
+ if (loop) {
59653
+ tween.loop(loop, repeat);
59654
+ }
59655
+
59656
+ if (infinite) {
59657
+ var timeToCompleteLoop = time * 2;
59658
+ setTimeout(onComplete, timeToCompleteLoop);
59659
+ } else {
59660
+ tween.on(EASING_EVENTS.COMPLETE, onComplete);
59661
+ }
59662
+ });
59663
+ };var easing=/*#__PURE__*/Object.freeze({__proto__:null,LOOPING:LOOPING,EASING_EVENTS:EASING_EVENTS,FUNCTIONS:FUNCTIONS,tweenTo:tweenTo});var Entity = /*#__PURE__*/function (_EventDispatcher) {
59552
59664
  _inherits(Entity, _EventDispatcher);
59553
59665
 
59554
59666
  var _super = _createSuper(Entity);
@@ -59577,7 +59689,7 @@ var prepareModel = function prepareModel(model) {
59577
59689
  });
59578
59690
 
59579
59691
  _defineProperty$1(_assertThisInitialized(_this), "addTag", function (tagName) {
59580
- if (!tagName) return;
59692
+ if (!tagName) return false;
59581
59693
 
59582
59694
  if (!_this.hasTag(tagName)) {
59583
59695
  _this.tags.push(tagName);
@@ -59714,7 +59826,10 @@ var prepareModel = function prepareModel(model) {
59714
59826
  }
59715
59827
  }, {
59716
59828
  key: "setBody",
59717
- value: function setBody(body) {
59829
+ value: function setBody() {
59830
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
59831
+ body = _ref3.body;
59832
+
59718
59833
  this.body = body;
59719
59834
  }
59720
59835
  }, {
@@ -59739,11 +59854,11 @@ var prepareModel = function prepareModel(model) {
59739
59854
 
59740
59855
  var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getBody();
59741
59856
 
59742
- var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
59743
- _ref3$waitForBody = _ref3.waitForBody,
59744
- waitForBody = _ref3$waitForBody === void 0 ? 0 : _ref3$waitForBody,
59745
- _ref3$waitForBodyMaxR = _ref3.waitForBodyMaxRetries,
59746
- waitForBodyMaxRetries = _ref3$waitForBodyMaxR === void 0 ? 1 : _ref3$waitForBodyMaxR;
59857
+ var _ref4 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
59858
+ _ref4$waitForBody = _ref4.waitForBody,
59859
+ waitForBody = _ref4$waitForBody === void 0 ? 0 : _ref4$waitForBody,
59860
+ _ref4$waitForBodyMaxR = _ref4.waitForBodyMaxRetries,
59861
+ waitForBodyMaxRetries = _ref4$waitForBodyMaxR === void 0 ? 1 : _ref4$waitForBodyMaxR;
59747
59862
 
59748
59863
  if (this.hasBody()) {
59749
59864
  var _add = function _add(toAdd) {
@@ -59847,13 +59962,15 @@ var prepareModel = function prepareModel(model) {
59847
59962
  value: function removeTag(tagName) {
59848
59963
  if (tagName === DEFAULT_TAG) {
59849
59964
  console.log(TAG_CANT_BE_REMOVED);
59850
- return;
59965
+ return false;
59851
59966
  }
59852
59967
 
59853
59968
  if (this.hasTag(tagName)) {
59854
59969
  this.tags.splice(this.tags.indexOf(tagName), 1);
59970
+ return true;
59855
59971
  } else {
59856
59972
  console.log(TAG_NOT_EXISTING_REMOVAL);
59973
+ return false;
59857
59974
  }
59858
59975
  }
59859
59976
  }, {
@@ -59898,10 +60015,10 @@ var prepareModel = function prepareModel(model) {
59898
60015
  var _this4 = this;
59899
60016
 
59900
60017
  if (this.hasScripts()) {
59901
- this.scripts.forEach(function (_ref4) {
59902
- var script = _ref4.script,
59903
- enabled = _ref4.enabled,
59904
- options = _ref4.options;
60018
+ this.scripts.forEach(function (_ref5) {
60019
+ var script = _ref5.script,
60020
+ enabled = _ref5.enabled,
60021
+ options = _ref5.options;
59905
60022
 
59906
60023
  if (enabled) {
59907
60024
  script.start(_this4, options);
@@ -59915,9 +60032,9 @@ var prepareModel = function prepareModel(model) {
59915
60032
  key: "update",
59916
60033
  value: function update(dt) {
59917
60034
  if (this.hasScripts()) {
59918
- this.scripts.forEach(function (_ref5) {
59919
- var script = _ref5.script,
59920
- enabled = _ref5.enabled;
60035
+ this.scripts.forEach(function (_ref6) {
60036
+ var script = _ref6.script,
60037
+ enabled = _ref6.enabled;
59921
60038
 
59922
60039
  if (script && enabled) {
59923
60040
  script.update(dt);
@@ -59929,9 +60046,9 @@ var prepareModel = function prepareModel(model) {
59929
60046
  key: "onPhysicsUpdate",
59930
60047
  value: function onPhysicsUpdate(dt) {
59931
60048
  if (this.hasScripts()) {
59932
- this.scripts.forEach(function (_ref6) {
59933
- var script = _ref6.script,
59934
- enabled = _ref6.enabled;
60049
+ this.scripts.forEach(function (_ref7) {
60050
+ var script = _ref7.script,
60051
+ enabled = _ref7.enabled;
59935
60052
 
59936
60053
  if (script && enabled) {
59937
60054
  script.physicsUpdate(dt);
@@ -60021,6 +60138,7 @@ var prepareModel = function prepareModel(model) {
60021
60138
  return script;
60022
60139
  } else {
60023
60140
  console.warn(SCRIPT_NOT_FOUND);
60141
+ return false;
60024
60142
  }
60025
60143
  }
60026
60144
  }, {
@@ -60090,68 +60208,6 @@ var prepareModel = function prepareModel(model) {
60090
60208
  value: function getEntityType() {
60091
60209
  return this.entityType;
60092
60210
  }
60093
- }, {
60094
- key: "addLight",
60095
- // TODO: sounds should become entities
60096
- // addSound(name, options) {
60097
- // const { autoplay = false, ...opts } = options;
60098
- // this.isPlayingSound = autoplay;
60099
- // this.sound = new Sound(name, {
60100
- // autoplay,
60101
- // ...opts
60102
- // });
60103
- // this.sound.setTarget(this);
60104
- // return this.sound;
60105
- // }
60106
- // addDirectionalSound(name, options) {
60107
- // const { autoplay = false, ...opts } = options;
60108
- // this.isPlayingSound = autoplay;
60109
- // this.sound = new DirectionalSound(name, {
60110
- // autoplay,
60111
- // ...opts
60112
- // });
60113
- // this.sound.setTarget(this);
60114
- // return this.sound;
60115
- // }
60116
- // addAmbientSound(name, options) {
60117
- // const { autoplay = false, ...opts } = options;
60118
- // this.isPlayingSound = autoplay;
60119
- // this.sound = new AmbientSound(name, {
60120
- // body: this.body,
60121
- // autoplay,
60122
- // ...opts
60123
- // });
60124
- // return this.sound;
60125
- // }
60126
- value: function addLight(light) {
60127
- var _this$getPosition = this.getPosition(),
60128
- x = _this$getPosition.x,
60129
- y = _this$getPosition.y,
60130
- z = _this$getPosition.z;
60131
-
60132
- light.setPosition({
60133
- x: x,
60134
- y: y,
60135
- z: z
60136
- });
60137
- this.light = light;
60138
- }
60139
- }, {
60140
- key: "playSound",
60141
- value: function playSound() {
60142
- if (this.sound && !this.isPlayingSound) {
60143
- this.sound.play();
60144
- this.isPlayingSound = true;
60145
- }
60146
- }
60147
- }, {
60148
- key: "stopSound",
60149
- value: function stopSound() {
60150
- if (this.sound && this.isPlayingSound) {
60151
- this.sound.stop();
60152
- this.isPlayingSound = false;
60153
- }
60154
- }
60155
60211
  }, {
60156
60212
  key: "getScale",
60157
60213
  value: function getScale() {
@@ -60186,10 +60242,10 @@ var prepareModel = function prepareModel(model) {
60186
60242
  key: "setPosition",
60187
60243
  value: function setPosition(where) {
60188
60244
  if (this.hasBody()) {
60189
- var _this$getPosition2 = this.getPosition(),
60190
- x = _this$getPosition2.x,
60191
- y = _this$getPosition2.y,
60192
- z = _this$getPosition2.z;
60245
+ var _this$getPosition = this.getPosition(),
60246
+ x = _this$getPosition.x,
60247
+ y = _this$getPosition.y,
60248
+ z = _this$getPosition.z;
60193
60249
 
60194
60250
  var position = _objectSpread2$1({
60195
60251
  x: x,
@@ -60237,13 +60293,13 @@ var prepareModel = function prepareModel(model) {
60237
60293
  }
60238
60294
  }, {
60239
60295
  key: "translate",
60240
- value: function translate(_ref7) {
60241
- var _ref7$x = _ref7.x,
60242
- x = _ref7$x === void 0 ? 0 : _ref7$x,
60243
- _ref7$y = _ref7.y,
60244
- y = _ref7$y === void 0 ? 0 : _ref7$y,
60245
- _ref7$z = _ref7.z,
60246
- z = _ref7$z === void 0 ? 0 : _ref7$z;
60296
+ value: function translate(_ref8) {
60297
+ var _ref8$x = _ref8.x,
60298
+ x = _ref8$x === void 0 ? 0 : _ref8$x,
60299
+ _ref8$y = _ref8.y,
60300
+ y = _ref8$y === void 0 ? 0 : _ref8$y,
60301
+ _ref8$z = _ref8.z,
60302
+ z = _ref8$z === void 0 ? 0 : _ref8$z;
60247
60303
 
60248
60304
  if (this.hasBody()) {
60249
60305
  this.body.translateX(x);
@@ -60251,53 +60307,104 @@ var prepareModel = function prepareModel(model) {
60251
60307
  this.body.translateZ(z);
60252
60308
  }
60253
60309
  }
60310
+ }, {
60311
+ key: "scaleTo",
60312
+ value: function scaleTo() {
60313
+ var _this7 = this;
60314
+
60315
+ var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getScale();
60316
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
60317
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
60318
+
60319
+ var _this$getScale = this.getScale(),
60320
+ x = _this$getScale.x,
60321
+ y = _this$getScale.y,
60322
+ z = _this$getScale.z;
60323
+
60324
+ var target = _objectSpread2$1({
60325
+ x: x,
60326
+ y: y,
60327
+ z: z
60328
+ }, scale);
60329
+
60330
+ var onUpdate = function onUpdate(value) {
60331
+ return !_this7.isDisposed() && _this7.setScale(value);
60332
+ };
60333
+
60334
+ return tweenTo({
60335
+ x: x,
60336
+ y: y,
60337
+ z: z
60338
+ }, target, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
60339
+ time: time,
60340
+ onUpdate: onUpdate
60341
+ }));
60342
+ }
60254
60343
  }, {
60255
60344
  key: "rotateTo",
60256
60345
  value: function rotateTo() {
60257
- var _this7 = this;
60346
+ var _this8 = this;
60258
60347
 
60259
60348
  var rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getRotation();
60260
60349
  var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
60261
- var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Between.Easing.Linear.None;
60350
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
60262
60351
 
60263
60352
  var _this$getRotation2 = this.getRotation(),
60264
60353
  x = _this$getRotation2.x,
60265
60354
  y = _this$getRotation2.y,
60266
60355
  z = _this$getRotation2.z;
60267
60356
 
60268
- return new Promise(function (resolve) {
60269
- return new Between({
60270
- x: x,
60271
- y: y,
60272
- z: z
60273
- }, rotation).time(time).easing(easing).on('update', function (value) {
60274
- return !_this7.isDisposed() && _this7.setRotation(value);
60275
- }).on('complete', resolve);
60276
- });
60357
+ var target = _objectSpread2$1({
60358
+ x: x,
60359
+ y: y,
60360
+ z: z
60361
+ }, rotation);
60362
+
60363
+ var onUpdate = function onUpdate(value) {
60364
+ return !_this8.isDisposed() && _this8.setRotation(value);
60365
+ };
60366
+
60367
+ return tweenTo({
60368
+ x: x,
60369
+ y: y,
60370
+ z: z
60371
+ }, target, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
60372
+ time: time,
60373
+ onUpdate: onUpdate
60374
+ }));
60277
60375
  }
60278
60376
  }, {
60279
60377
  key: "goTo",
60280
60378
  value: function goTo() {
60281
- var _this8 = this;
60379
+ var _this9 = this;
60282
60380
 
60283
60381
  var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getPosition();
60284
60382
  var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
60285
- var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Between.Easing.Linear.None;
60383
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
60286
60384
 
60287
- var _this$getPosition3 = this.getPosition(),
60288
- x = _this$getPosition3.x,
60289
- y = _this$getPosition3.y,
60290
- z = _this$getPosition3.z;
60385
+ var _this$getPosition2 = this.getPosition(),
60386
+ x = _this$getPosition2.x,
60387
+ y = _this$getPosition2.y,
60388
+ z = _this$getPosition2.z;
60291
60389
 
60292
- return new Promise(function (resolve) {
60293
- return new Between({
60294
- x: x,
60295
- y: y,
60296
- z: z
60297
- }, position).time(time).easing(easing).on('update', function (value) {
60298
- return !_this8.isDisposed() && _this8.setPosition(value);
60299
- }).on('complete', resolve);
60300
- });
60390
+ var target = _objectSpread2$1({
60391
+ x: x,
60392
+ y: y,
60393
+ z: z
60394
+ }, position);
60395
+
60396
+ var onUpdate = function onUpdate(value) {
60397
+ return !_this9.isDisposed() && _this9.setPosition(value);
60398
+ };
60399
+
60400
+ return tweenTo({
60401
+ x: x,
60402
+ y: y,
60403
+ z: z
60404
+ }, target, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
60405
+ time: time,
60406
+ onUpdate: onUpdate
60407
+ }));
60301
60408
  }
60302
60409
  }, {
60303
60410
  key: "uuid",
@@ -60368,10 +60475,10 @@ var prepareModel = function prepareModel(model) {
60368
60475
  }, {
60369
60476
  key: "mapScriptsToJSON",
60370
60477
  value: function mapScriptsToJSON() {
60371
- this.scripts.reduce(function (acc, _ref8) {
60372
- var name = _ref8.name,
60373
- _ref8$options = _ref8.options,
60374
- options = _ref8$options === void 0 ? {} : _ref8$options;
60478
+ this.scripts.reduce(function (acc, _ref9) {
60479
+ var name = _ref9.name,
60480
+ _ref9$options = _ref9.options,
60481
+ options = _ref9$options === void 0 ? {} : _ref9$options;
60375
60482
  acc.names.push(name);
60376
60483
  acc.options.push(options);
60377
60484
  return acc;
@@ -60397,8 +60504,11 @@ var prepareModel = function prepareModel(model) {
60397
60504
  }], [{
60398
60505
  key: "create",
60399
60506
  value: function create() {
60400
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
60401
- return new this(options);
60507
+ for (var _len = arguments.length, options = new Array(_len), _key = 0; _key < _len; _key++) {
60508
+ options[_key] = arguments[_key];
60509
+ }
60510
+
60511
+ return _construct(this, options);
60402
60512
  }
60403
60513
  }]);
60404
60514
 
@@ -60766,17 +60876,6 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
60766
60876
  }
60767
60877
 
60768
60878
  _createClass(Element, [{
60769
- key: "getMaterialType",
60770
- value: function getMaterialType() {
60771
- return this.materialType;
60772
- }
60773
- }, {
60774
- key: "setMaterialType",
60775
- value: function setMaterialType() {
60776
- var materialType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIALS.BASIC;
60777
- this.materialType = materialType;
60778
- }
60779
- }, {
60780
60879
  key: "addTag",
60781
60880
  value: function addTag(tag) {
60782
60881
  _get(_getPrototypeOf(Element.prototype), "addTag", this).call(this, tag);
@@ -61149,20 +61248,48 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61149
61248
  }
61150
61249
  }
61151
61250
  }
61251
+ }, {
61252
+ key: "getMaterial",
61253
+ value: function getMaterial() {
61254
+ if (hasMaterial(this.getBody())) {
61255
+ return this.getBody().material;
61256
+ }
61257
+
61258
+ var materials = [];
61259
+ this.getBody().traverse(function (child) {
61260
+ if (hasMaterial(child)) {
61261
+ materials.push(child.material);
61262
+ }
61263
+ });
61264
+ return materials;
61265
+ }
61266
+ }, {
61267
+ key: "getMaterialType",
61268
+ value: function getMaterialType() {
61269
+ return this.materialType;
61270
+ }
61271
+ }, {
61272
+ key: "setMaterialType",
61273
+ value: function setMaterialType() {
61274
+ var materialType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MATERIALS.BASIC;
61275
+ this.materialType = materialType;
61276
+ }
61152
61277
  }, {
61153
61278
  key: "setMaterialFromName",
61154
61279
  value: function setMaterialFromName(materialName) {
61155
61280
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
61156
61281
  this.setMaterialType(materialName);
61282
+ var newMaterials = [];
61157
61283
 
61158
61284
  if (hasMaterial(this.getBody())) {
61159
- changeMaterialByName(materialName, this.getBody(), options);
61285
+ return replaceMaterialByName(materialName, this.getBody(), options);
61160
61286
  } else {
61161
61287
  this.getBody().traverse(function (child) {
61162
61288
  if (hasMaterial(child)) {
61163
- changeMaterialByName(materialName, child, options);
61289
+ newMaterials.push(replaceMaterialByName(materialName, child, options));
61164
61290
  }
61165
61291
  });
61292
+ return newMaterials;
61166
61293
  }
61167
61294
  }
61168
61295
  }, {
@@ -61310,8 +61437,11 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61310
61437
  name: name
61311
61438
  });
61312
61439
  _this.options = options;
61440
+ var body = new PerspectiveCamera(fov, ratio, near, far);
61313
61441
 
61314
- _this.setBody(new PerspectiveCamera(fov, ratio, near, far));
61442
+ _this.setBody({
61443
+ body: body
61444
+ });
61315
61445
 
61316
61446
  _this.setEntityType(ENTITY_TYPES.CAMERA);
61317
61447
 
@@ -69199,7 +69329,7 @@ var engine = new Video();var GLTFLoader = function () {
69199
69329
 
69200
69330
  function assignExtrasToUserData(object, gltfDef) {
69201
69331
  if (gltfDef.extras !== undefined) {
69202
- if (_typeof$1(gltfDef.extras) === 'object') {
69332
+ if (_typeof(gltfDef.extras) === 'object') {
69203
69333
  Object.assign(object.userData, gltfDef.extras);
69204
69334
  } else {
69205
69335
  console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras);
@@ -74252,7 +74382,7 @@ var FBXTreeParser = /*#__PURE__*/function () {
74252
74382
  var name = materialNode.attrName;
74253
74383
  var type = materialNode.ShadingModel; // Case where FBX wraps shading model in property object.
74254
74384
 
74255
- if (_typeof$1(type) === 'object') {
74385
+ if (_typeof(type) === 'object') {
74256
74386
  type = type.value;
74257
74387
  } // Ignore unused materials which don't have any connections.
74258
74388
 
@@ -82140,6 +82270,8 @@ var Stats = /*#__PURE__*/function () {
82140
82270
  this._fps = 0;
82141
82271
  this._fpsMax = 100;
82142
82272
  this.fps = new Subject();
82273
+ this.memory = new Subject();
82274
+ this.memoryMax = new Subject();
82143
82275
  }
82144
82276
 
82145
82277
  _createClass(Stats, [{
@@ -82177,8 +82309,8 @@ var Stats = /*#__PURE__*/function () {
82177
82309
  key: "getMemoryUsage",
82178
82310
  value: function getMemoryUsage() {
82179
82311
  if (Features$1.isFeatureSupported(FEATURES.MEMORY)) {
82180
- this.memory = performance.memory.usedJSHeapSize / ONE_MB;
82181
- this.memoryMax = performance.memory.jsHeapSizeLimit / ONE_MB;
82312
+ this.memory.next(performance.memory.usedJSHeapSize / ONE_MB);
82313
+ this.memoryMax.next(performance.memory.jsHeapSizeLimit / ONE_MB);
82182
82314
  }
82183
82315
  }
82184
82316
  }, {
@@ -82415,12 +82547,16 @@ var Light = /*#__PURE__*/function (_Entity) {
82415
82547
  var _this2 = this;
82416
82548
 
82417
82549
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getIntensity();
82418
- var time = arguments.length > 1 ? arguments[1] : undefined;
82550
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
82419
82551
  var intensity = this.getIntensity();
82420
- return new Promise(function (resolve) {
82421
- return new Between(intensity, value).time(time).on('update', function (value) {
82422
- return !_this2.isDisposed() && _this2.setIntensity(value);
82423
- }).on('complete', resolve);
82552
+
82553
+ var onUpdate = function onUpdate(value) {
82554
+ return !_this2.isDisposed() && _this2.setIntensity(value);
82555
+ };
82556
+
82557
+ return tweenTo(intensity, value, {
82558
+ time: time,
82559
+ onUpdate: onUpdate
82424
82560
  });
82425
82561
  }
82426
82562
  }, {
@@ -82456,20 +82592,12 @@ var Light = /*#__PURE__*/function (_Entity) {
82456
82592
  }, {
82457
82593
  key: "toJSON",
82458
82594
  value: function toJSON() {
82459
- var _this$body$position = this.body.position,
82460
- x = _this$body$position.x,
82461
- y = _this$body$position.y,
82462
- z = _this$body$position.z;
82463
- return {
82464
- position: {
82465
- x: x,
82466
- y: y,
82467
- z: z
82468
- },
82595
+ return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Light.prototype), "toJSON", this).call(this)), {}, {
82596
+ type: this.getEntityType(),
82469
82597
  color: this.color,
82470
82598
  intensity: this.intensity,
82471
82599
  name: this.name
82472
- };
82600
+ });
82473
82601
  }
82474
82602
  }]);
82475
82603
 
@@ -82534,9 +82662,13 @@ var SunLight = /*#__PURE__*/function (_Light) {
82534
82662
  intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$4 : _ref$intensity;
82535
82663
 
82536
82664
  if (light) {
82537
- this.setBody(light);
82665
+ this.setBody({
82666
+ body: light
82667
+ });
82538
82668
  } else {
82539
- this.setBody(new DirectionalLight(color, intensity));
82669
+ this.setBody({
82670
+ body: new DirectionalLight(color, intensity)
82671
+ });
82540
82672
  }
82541
82673
 
82542
82674
  if (this.hasBody()) {
@@ -82572,9 +82704,11 @@ var SunLight = /*#__PURE__*/function (_Light) {
82572
82704
  _this$options2$bias = _this$options2.bias,
82573
82705
  bias = _this$options2$bias === void 0 ? DEFAULT_BIAS$2 : _this$options2$bias,
82574
82706
  _this$options2$fov = _this$options2.fov,
82575
- fov = _this$options2$fov === void 0 ? DEFAULT_FOV : _this$options2$fov;
82707
+ fov = _this$options2$fov === void 0 ? DEFAULT_FOV : _this$options2$fov,
82708
+ _this$options2$castSh = _this$options2.castShadow,
82709
+ castShadow = _this$options2$castSh === void 0 ? true : _this$options2$castSh;
82576
82710
 
82577
- if (Config$1.lights().shadows) {
82711
+ if (Config$1.lights().shadows && castShadow) {
82578
82712
  this.body.castShadow = true;
82579
82713
  var d = far / 1.5;
82580
82714
  this.body.shadow.mapSize.height = mapSize;
@@ -82642,13 +82776,6 @@ var SunLight = /*#__PURE__*/function (_Light) {
82642
82776
  });
82643
82777
  }
82644
82778
  }
82645
- }, {
82646
- key: "toJSON",
82647
- value: function toJSON() {
82648
- return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SunLight.prototype), "toJSON", this).call(this)), {}, {
82649
- type: SUNLIGHT
82650
- });
82651
- }
82652
82779
  }]);
82653
82780
 
82654
82781
  return SunLight;
@@ -82707,9 +82834,13 @@ var AmbientLight = /*#__PURE__*/function (_Light) {
82707
82834
  intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$3 : _ref$intensity;
82708
82835
 
82709
82836
  if (light) {
82710
- this.setBody(light);
82837
+ this.setBody({
82838
+ body: light
82839
+ });
82711
82840
  } else {
82712
- this.setBody(new AmbientLight$1(color, intensity));
82841
+ this.setBody({
82842
+ body: new AmbientLight$1(color, intensity)
82843
+ });
82713
82844
  }
82714
82845
 
82715
82846
  if (this.hasBody()) {
@@ -82741,13 +82872,6 @@ var AmbientLight = /*#__PURE__*/function (_Light) {
82741
82872
  });
82742
82873
  }
82743
82874
  }
82744
- }, {
82745
- key: "toJSON",
82746
- value: function toJSON() {
82747
- return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(AmbientLight.prototype), "toJSON", this).call(this)), {}, {
82748
- type: AMBIENTLIGHT
82749
- });
82750
- }
82751
82875
  }]);
82752
82876
 
82753
82877
  return AmbientLight;
@@ -82819,9 +82943,13 @@ var PointLight = /*#__PURE__*/function (_Light) {
82819
82943
  decay = _ref$decay === void 0 ? DEFAULT_DECAY : _ref$decay;
82820
82944
 
82821
82945
  if (light) {
82822
- this.setBody(light);
82946
+ this.setBody({
82947
+ body: light
82948
+ });
82823
82949
  } else {
82824
- this.setBody(new PointLight$1(color, intensity, distance, decay));
82950
+ this.setBody({
82951
+ body: new PointLight$1(color, intensity, distance, decay)
82952
+ });
82825
82953
  }
82826
82954
 
82827
82955
  if (this.hasBody()) {
@@ -82893,8 +83021,7 @@ var PointLight = /*#__PURE__*/function (_Light) {
82893
83021
  key: "toJSON",
82894
83022
  value: function toJSON() {
82895
83023
  return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(PointLight.prototype), "toJSON", this).call(this)), {}, {
82896
- distance: this.distance,
82897
- type: POINTLIGHT
83024
+ distance: this.distance
82898
83025
  });
82899
83026
  }
82900
83027
  }]);
@@ -85361,21 +85488,7 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
85361
85488
  }
85362
85489
 
85363
85490
  return Fountain;
85364
- }(ParticleEmitter);var three_proton_min = {exports: {}};var require$$0 = /*@__PURE__*/getAugmentedNamespace(three_module);/*!
85365
- * three.proton v0.2.0
85366
- * https://github.com/drawcall/three.proton
85367
- *
85368
- * Copyright 2011-2020, ajiemath
85369
- * Licensed under the MIT license
85370
- * http://www.opensource.org/licenses/mit-license
85371
- *
85372
- */
85373
-
85374
- (function (module, exports) {
85375
- (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});
85376
- }(three_proton_min));
85377
-
85378
- var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/function (_Entity) {
85491
+ }(ParticleEmitter);var ParticleEmitterGroup = /*#__PURE__*/function (_Entity) {
85379
85492
  _inherits(ParticleEmitterGroup, _Entity);
85380
85493
 
85381
85494
  var _super = _createSuper(ParticleEmitterGroup);
@@ -90062,21 +90175,25 @@ var Label = /*#__PURE__*/function (_Element) {
90062
90175
  Images$1.add(id, texture);
90063
90176
  }
90064
90177
 
90065
- texture.image.src = dataUrl;
90066
- texture.image.height = height;
90067
- texture.image.width = width;
90068
- texture.needsUpdate = true;
90178
+ if (texture.image.src !== dataUrl) {
90179
+ texture.image.src = dataUrl;
90180
+ texture.image.height = height;
90181
+ texture.image.width = width;
90182
+ texture.needsUpdate = true;
90183
+ }
90184
+
90069
90185
  return Promise.resolve(texture);
90070
90186
  };
90071
90187
  });
90072
90188
 
90073
90189
  _defineProperty$1(_assertThisInitialized(_this), "convertToPng", function (domElement) {
90074
90190
  return domElement ? toPng(domElement, {
90075
- cacheBust: true
90191
+ cacheBust: false
90076
90192
  }) : Promise.reject(LABEL_DOMELEMENT_MISSING);
90077
90193
  });
90078
90194
 
90079
- var name = _this.options.name;
90195
+ var _this$options$name = _this.options.name,
90196
+ name = _this$options$name === void 0 ? generateRandomName('label') : _this$options$name;
90080
90197
  _this.Component = Component;
90081
90198
  _this.format = format;
90082
90199
  _this.width = _width;
@@ -90108,6 +90225,97 @@ var Label = /*#__PURE__*/function (_Element) {
90108
90225
  }]);
90109
90226
 
90110
90227
  return Label;
90228
+ }(Element$1);var Color = /*#__PURE__*/function () {
90229
+ _createClass(Color, null, [{
90230
+ key: "randomColor",
90231
+ value: function randomColor() {
90232
+ var asNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
90233
+ var letters = '0123456789ABCDEF'.split('');
90234
+ var color = '';
90235
+
90236
+ for (var i = 0; i < 6; i++) {
90237
+ color += letters[Math.floor(Math.random() * 16)];
90238
+ }
90239
+
90240
+ return asNumber ? Number("0x".concat(color)) : "#".concat(color);
90241
+ }
90242
+ }, {
90243
+ key: "componentToHex",
90244
+ value: function componentToHex(c) {
90245
+ var hex = c.toString(16);
90246
+ return hex.length == 1 ? "0" + hex : hex;
90247
+ }
90248
+ }, {
90249
+ key: "gbToHex",
90250
+ value: function gbToHex(r, g, b) {
90251
+ return "0x" + Color.componentToHex(r) + Color.componentToHex(g) + Color.componentToHex(b);
90252
+ }
90253
+ }, {
90254
+ key: "getIntValueFromHex",
90255
+ value: function getIntValueFromHex(hex) {
90256
+ return parseInt(hex, 16);
90257
+ }
90258
+ }]);
90259
+
90260
+ function Color(color) {
90261
+ _classCallCheck(this, Color);
90262
+
90263
+ this.color = new Color$1(color);
90264
+ }
90265
+
90266
+ _createClass(Color, [{
90267
+ key: "getColor",
90268
+ value: function getColor() {
90269
+ return this.color;
90270
+ }
90271
+ }]);
90272
+
90273
+ return Color;
90274
+ }();var DEFAULT_RADIUS = 5;
90275
+ var DEFAULT_HEIGHT = 5;
90276
+ var DEFAULT_RADIAL_SEGMENTS = 8;
90277
+ var DEFAULT_HEIGHT_SEGMENTS = 1;
90278
+ var DEFAULT_OPENENDED = false;
90279
+
90280
+ var Cone = /*#__PURE__*/function (_Element) {
90281
+ _inherits(Cone, _Element);
90282
+
90283
+ var _super = _createSuper(Cone);
90284
+
90285
+ function Cone() {
90286
+ var _this;
90287
+
90288
+ var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_RADIUS;
90289
+ var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HEIGHT;
90290
+ var color = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Color.randomColor(true);
90291
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
90292
+
90293
+ _classCallCheck(this, Cone);
90294
+
90295
+ _this = _super.call(this, options);
90296
+ var _options$radialSegmen = options.radialSegments,
90297
+ radialSegments = _options$radialSegmen === void 0 ? DEFAULT_RADIAL_SEGMENTS : _options$radialSegmen,
90298
+ _options$heightSegmen = options.heightSegments,
90299
+ heightSegments = _options$heightSegmen === void 0 ? DEFAULT_HEIGHT_SEGMENTS : _options$heightSegmen,
90300
+ _options$openEnded = options.openEnded,
90301
+ openEnded = _options$openEnded === void 0 ? DEFAULT_OPENENDED : _options$openEnded;
90302
+ var geometry = new ConeGeometry(radius, height, radialSegments, heightSegments, openEnded);
90303
+ var material = new MeshBasicMaterial(_objectSpread2$1({
90304
+ color: color,
90305
+ wireframe: false
90306
+ }, options));
90307
+
90308
+ _this.setBody({
90309
+ geometry: geometry,
90310
+ material: material
90311
+ });
90312
+
90313
+ _this.setEntityType(ENTITY_TYPES.MESH);
90314
+
90315
+ return _this;
90316
+ }
90317
+
90318
+ return Cone;
90111
90319
  }(Element$1);var Beat = /*#__PURE__*/function () {
90112
90320
  function Beat(name) {
90113
90321
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -90603,53 +90811,7 @@ var Label = /*#__PURE__*/function (_Element) {
90603
90811
  }]);
90604
90812
 
90605
90813
  return Sound;
90606
- }(Beat);var Color = /*#__PURE__*/function () {
90607
- _createClass(Color, null, [{
90608
- key: "randomColor",
90609
- value: function randomColor() {
90610
- var asNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
90611
- var letters = '0123456789ABCDEF'.split('');
90612
- var color = '';
90613
-
90614
- for (var i = 0; i < 6; i++) {
90615
- color += letters[Math.floor(Math.random() * 16)];
90616
- }
90617
-
90618
- return asNumber ? Number("0x".concat(color)) : "#".concat(color);
90619
- }
90620
- }, {
90621
- key: "componentToHex",
90622
- value: function componentToHex(c) {
90623
- var hex = c.toString(16);
90624
- return hex.length == 1 ? "0" + hex : hex;
90625
- }
90626
- }, {
90627
- key: "gbToHex",
90628
- value: function gbToHex(r, g, b) {
90629
- return "0x" + Color.componentToHex(r) + Color.componentToHex(g) + Color.componentToHex(b);
90630
- }
90631
- }, {
90632
- key: "getIntValueFromHex",
90633
- value: function getIntValueFromHex(hex) {
90634
- return parseInt(hex, 16);
90635
- }
90636
- }]);
90637
-
90638
- function Color(color) {
90639
- _classCallCheck(this, Color);
90640
-
90641
- this.color = new Color$1(color);
90642
- }
90643
-
90644
- _createClass(Color, [{
90645
- key: "getColor",
90646
- value: function getColor() {
90647
- return this.color;
90648
- }
90649
- }]);
90650
-
90651
- return Color;
90652
- }();var BLOB_TYPE = 'application/javascript';
90814
+ }(Beat);var BLOB_TYPE = 'application/javascript';
90653
90815
  var createBlob = function createBlob(task) {
90654
90816
  return new Blob(['(', task.toString(), ')()'], {
90655
90817
  type: BLOB_TYPE
@@ -90771,15 +90933,20 @@ var DEFAULT_MAP_SIZE = 2048;
90771
90933
  var DEFAULT_BIAS = -0.0001;
90772
90934
  var WHITE = 0xffffff;
90773
90935
  var GREEN$1 = 0x2ecc71;
90936
+ var DEFAULT_SPOTLIGHT_ANGLE = .32;
90937
+ var DEFAULT_SPOTLIGHT_PENUMBRA = .5;
90938
+ var DEFAULT_SPOTLIGHT_DECAY = 2;
90774
90939
 
90775
90940
  var SpotLight = /*#__PURE__*/function (_Light) {
90776
90941
  _inherits(SpotLight, _Light);
90777
90942
 
90778
90943
  var _super = _createSuper(SpotLight);
90779
90944
 
90780
- function SpotLight(options) {
90945
+ function SpotLight() {
90781
90946
  var _this;
90782
90947
 
90948
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
90949
+
90783
90950
  _classCallCheck(this, SpotLight);
90784
90951
 
90785
90952
  var _options$color = options.color,
@@ -90787,7 +90954,15 @@ var SpotLight = /*#__PURE__*/function (_Light) {
90787
90954
  _options$intensity = options.intensity,
90788
90955
  intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$1 : _options$intensity,
90789
90956
  _options$name = options.name,
90790
- name = _options$name === void 0 ? generateRandomName('SpotLight') : _options$name;
90957
+ name = _options$name === void 0 ? generateRandomName('SpotLight') : _options$name,
90958
+ _options$distance = options.distance,
90959
+ distance = _options$distance === void 0 ? DEFAULT_FAR : _options$distance,
90960
+ _options$angle = options.angle,
90961
+ angle = _options$angle === void 0 ? DEFAULT_SPOTLIGHT_ANGLE : _options$angle,
90962
+ _options$penumbra = options.penumbra,
90963
+ penumbra = _options$penumbra === void 0 ? DEFAULT_SPOTLIGHT_PENUMBRA : _options$penumbra,
90964
+ _options$decay = options.decay,
90965
+ decay = _options$decay === void 0 ? DEFAULT_SPOTLIGHT_DECAY : _options$decay;
90791
90966
  _this = _super.call(this, {
90792
90967
  color: color,
90793
90968
  intensity: intensity,
@@ -90797,7 +90972,11 @@ var SpotLight = /*#__PURE__*/function (_Light) {
90797
90972
 
90798
90973
  _this.setLight({
90799
90974
  color: color,
90800
- intensity: intensity
90975
+ intensity: intensity,
90976
+ distance: distance,
90977
+ angle: angle,
90978
+ penumbra: penumbra,
90979
+ decay: decay
90801
90980
  });
90802
90981
 
90803
90982
  _this.setEntityType(ENTITY_TYPES.LIGHT.SPOT);
@@ -90829,12 +91008,20 @@ var SpotLight = /*#__PURE__*/function (_Light) {
90829
91008
  _ref$color = _ref.color,
90830
91009
  color = _ref$color === void 0 ? WHITE : _ref$color,
90831
91010
  _ref$intensity = _ref.intensity,
90832
- intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$1 : _ref$intensity;
91011
+ intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$1 : _ref$intensity,
91012
+ distance = _ref.distance,
91013
+ angle = _ref.angle,
91014
+ penumbra = _ref.penumbra,
91015
+ decay = _ref.decay;
90833
91016
 
90834
91017
  if (light) {
90835
- this.setBody(light);
91018
+ this.setBody({
91019
+ body: light
91020
+ });
90836
91021
  } else {
90837
- this.setBody(new SpotLight$1(color, intensity));
91022
+ this.setBody({
91023
+ body: new SpotLight$1(color, intensity, distance, angle, penumbra, decay)
91024
+ });
90838
91025
  }
90839
91026
 
90840
91027
  if (this.hasBody()) {
@@ -90930,13 +91117,6 @@ var SpotLight = /*#__PURE__*/function (_Light) {
90930
91117
  });
90931
91118
  }
90932
91119
  }
90933
- }, {
90934
- key: "toJSON",
90935
- value: function toJSON() {
90936
- return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SpotLight.prototype), "toJSON", this).call(this)), {}, {
90937
- type: SPOTLIGHT
90938
- });
90939
- }
90940
91120
  }]);
90941
91121
 
90942
91122
  return SpotLight;
@@ -90998,13 +91178,17 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
90998
91178
  intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY : _ref$intensity;
90999
91179
 
91000
91180
  if (light) {
91001
- this.setBody(light);
91181
+ this.setBody({
91182
+ body: light
91183
+ });
91002
91184
  } else {
91003
91185
  var _color$sky = color.sky,
91004
91186
  sky = _color$sky === void 0 ? DEFAULT_SKY_COLOR : _color$sky,
91005
91187
  _color$ground = color.ground,
91006
91188
  ground = _color$ground === void 0 ? DEFAULT_GROUND_COLOR : _color$ground;
91007
- this.setBody(new HemisphereLight$1(sky, ground, intensity));
91189
+ this.setBody({
91190
+ body: new HemisphereLight$1(sky, ground, intensity)
91191
+ });
91008
91192
  }
91009
91193
 
91010
91194
  if (this.hasBody()) {
@@ -91017,13 +91201,6 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
91017
91201
  this.helper = new HemisphereLightHelper(this.body, 2, GREEN);
91018
91202
  Scene$1.add(this.helper, null, false);
91019
91203
  }
91020
- }, {
91021
- key: "toJSON",
91022
- value: function toJSON() {
91023
- return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(HemisphereLight.prototype), "toJSON", this).call(this)), {}, {
91024
- type: HEMISPHERELIGHT
91025
- });
91026
- }
91027
91204
  }]);
91028
91205
 
91029
91206
  return HemisphereLight;
@@ -92603,4 +92780,4 @@ var Shaders$1 = new Shaders();var Shader = function Shader(name, attributes, uni
92603
92780
  } else {
92604
92781
  this.instance = this.shader.instance;
92605
92782
  }
92606
- };var constants = _objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants);export{AUDIO_RAMPS,AmbientLight,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BackgroundSound,BaseScript,Box,Camera,Color,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,LightLoader$1 as LightLoader,Lights$1 as Lights,Line,MeshLoader$1 as MeshLoader,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,constants$1 as 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,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,functions,hitbox as hitboxUtils,index_esm as inferno,math,utils as physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers};
92783
+ };var constants = _objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants);export{AUDIO_RAMPS,AmbientLight,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BackgroundSound,BaseScript,Box,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,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,LightLoader$1 as LightLoader,Lights$1 as Lights,Line,MeshLoader$1 as MeshLoader,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,constants$1 as PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,index$1 as Partykals,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,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,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,math,utils as physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers};