mage-engine 3.20.2 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mage.js +430 -467
- package/package.json +1 -1
- package/prettier.config.js +7 -0
package/dist/mage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
2
2
|
var keys = Object.keys(object);
|
|
3
3
|
|
|
4
4
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -371,13 +371,28 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
|
-
}var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
374
|
+
}var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
375
|
+
|
|
376
|
+
function getAugmentedNamespace(n) {
|
|
377
|
+
if (n.__esModule) return n;
|
|
378
|
+
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
379
|
+
Object.keys(n).forEach(function (k) {
|
|
380
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
381
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
382
|
+
enumerable: true,
|
|
383
|
+
get: function () {
|
|
384
|
+
return n[k];
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
return a;
|
|
389
|
+
}var between$1 = {exports: {}};/* Between.js v0.1.2-fix.2 */
|
|
375
390
|
|
|
376
391
|
(function (module, exports) {
|
|
377
392
|
!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});
|
|
378
|
-
}(between));
|
|
393
|
+
}(between$1));
|
|
379
394
|
|
|
380
|
-
var
|
|
395
|
+
var between = between$1.exports;/*! *****************************************************************************
|
|
381
396
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
382
397
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
383
398
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -53603,7 +53618,6 @@ var BOUNDINGBOX_NOT_AVAILABLE = "".concat(PREFIX, " Selected element does not ha
|
|
|
53603
53618
|
var INVALID_EMITTER_ID = "".concat(PREFIX, " The selected emitter id is not valid.");
|
|
53604
53619
|
var EMITTER_NOT_FOUND = "".concat(PREFIX, " The requested emitter could not be found");
|
|
53605
53620
|
var FEATURE_NOT_SUPPORTED = "".concat(PREFIX, " The following features are not supported: ");
|
|
53606
|
-
var METHOD_NOT_SUPPORTED = "".concat(PREFIX, " This method is not supported.");
|
|
53607
53621
|
var ANIMATION_NOT_FOUND = "".concat(PREFIX, " Required animation can't be found.");
|
|
53608
53622
|
var ANIMATION_HANDLER_NOT_FOUND = "".concat(PREFIX, " AnimationHander hasn't been defined yet.");
|
|
53609
53623
|
var ELEMENT_NOT_SET$1 = "".concat(PREFIX, " Body hasn't been defined yet.");
|
|
@@ -54729,7 +54743,8 @@ var Universe$1 = new Universe();var generateUUID = function generateUUID() {
|
|
|
54729
54743
|
};
|
|
54730
54744
|
var generateRandomName = function generateRandomName(prefix) {
|
|
54731
54745
|
return "".concat(prefix, "_").concat(generateUUID());
|
|
54732
|
-
};var uuid$1=/*#__PURE__*/Object.freeze({__proto__:null,generateUUID:generateUUID,generateRandomName:generateRandomName});var
|
|
54746
|
+
};var uuid$1=/*#__PURE__*/Object.freeze({__proto__:null,generateUUID:generateUUID,generateRandomName:generateRandomName});var ALMOST_ZERO = 0.00001;
|
|
54747
|
+
var UP$1 = 'UP';
|
|
54733
54748
|
var DOWN$1 = 'DOWN';
|
|
54734
54749
|
var LEFT = 'LEFT';
|
|
54735
54750
|
var RIGHT = 'RIGHT';
|
|
@@ -54830,7 +54845,7 @@ var EMPTY$2 = '';
|
|
|
54830
54845
|
var QUERY_START = '?';
|
|
54831
54846
|
var DEFAULT_SELECTOR = '#gameContainer';
|
|
54832
54847
|
var BEFORE_UNLOAD = 'beforeunload';
|
|
54833
|
-
var HASH_CHANGE = 'hashchange';var lib_constants=/*#__PURE__*/Object.freeze({__proto__:null,UP:UP$1,DOWN:DOWN$1,LEFT:LEFT,RIGHT:RIGHT,FRONT:FRONT,BACK:BACK,VECTOR_UP:VECTOR_UP,VECTOR_DOWN:VECTOR_DOWN,VECTOR_LEFT:VECTOR_LEFT,VECTOR_RIGHT:VECTOR_RIGHT,VECTOR_FRONT:VECTOR_FRONT,VECTOR_BACK:VECTOR_BACK,ORIGIN:ORIGIN,ZERO_QUATERNION:ZERO_QUATERNION,MATERIALS:MATERIALS,TEXTURES:TEXTURES,EFFECTS:EFFECTS,COLLISION_EVENT:COLLISION_EVENT,COLORS:COLORS,ASSETS_TYPES:ASSETS_TYPES,OUTPUT_ENCODINGS:OUTPUT_ENCODINGS,DEFAULT_OUTPUT_ENCODING:DEFAULT_OUTPUT_ENCODING,ROOT:ROOT,DIVIDER:DIVIDER,HASH:HASH,EMPTY:EMPTY$2,QUERY_START:QUERY_START,DEFAULT_SELECTOR:DEFAULT_SELECTOR,BEFORE_UNLOAD:BEFORE_UNLOAD,HASH_CHANGE:HASH_CHANGE});var buildAssetId = function buildAssetId(name, level) {
|
|
54848
|
+
var HASH_CHANGE = 'hashchange';var lib_constants=/*#__PURE__*/Object.freeze({__proto__:null,ALMOST_ZERO:ALMOST_ZERO,UP:UP$1,DOWN:DOWN$1,LEFT:LEFT,RIGHT:RIGHT,FRONT:FRONT,BACK:BACK,VECTOR_UP:VECTOR_UP,VECTOR_DOWN:VECTOR_DOWN,VECTOR_LEFT:VECTOR_LEFT,VECTOR_RIGHT:VECTOR_RIGHT,VECTOR_FRONT:VECTOR_FRONT,VECTOR_BACK:VECTOR_BACK,ORIGIN:ORIGIN,ZERO_QUATERNION:ZERO_QUATERNION,MATERIALS:MATERIALS,TEXTURES:TEXTURES,EFFECTS:EFFECTS,COLLISION_EVENT:COLLISION_EVENT,COLORS:COLORS,ASSETS_TYPES:ASSETS_TYPES,OUTPUT_ENCODINGS:OUTPUT_ENCODINGS,DEFAULT_OUTPUT_ENCODING:DEFAULT_OUTPUT_ENCODING,ROOT:ROOT,DIVIDER:DIVIDER,HASH:HASH,EMPTY:EMPTY$2,QUERY_START:QUERY_START,DEFAULT_SELECTOR:DEFAULT_SELECTOR,BEFORE_UNLOAD:BEFORE_UNLOAD,HASH_CHANGE:HASH_CHANGE});var buildAssetId = function buildAssetId(name, level) {
|
|
54834
54849
|
return level ? "".concat(level, "_").concat(name) : name;
|
|
54835
54850
|
};
|
|
54836
54851
|
var isLevelName = function isLevelName(level) {
|
|
@@ -55446,7 +55461,7 @@ var convertAmmoVector = function convertAmmoVector(_ref2) {
|
|
|
55446
55461
|
};
|
|
55447
55462
|
};var utils=/*#__PURE__*/Object.freeze({__proto__:null,DEFAULT_DESCRIPTION:DEFAULT_DESCRIPTION$1,mapColliderTypeToAddEvent:mapColliderTypeToAddEvent$1,extractBoundingBox:extractBoundingBox,extractBiggestBoundingBox:extractBiggestBoundingBox,extractBoundingSphere:extractBoundingSphere,extractBiggestBoundingSphere:extractBiggestBoundingSphere,parseBoundingBoxSize:parseBoundingBoxSize,extractPositionAndQuaternion:extractPositionAndQuaternion$1,extractBoxDescription:extractBoxDescription,extractSphereDescription:extractSphereDescription,getBoxDescriptionForElement:getBoxDescriptionForElement$1,getSphereDescriptionForElement:getSphereDescriptionForElement,mapColliderTypeToDescription:mapColliderTypeToDescription$1,iterateGeometries:iterateGeometries$1,convertAmmoVector:convertAmmoVector});var getHostURL = function getHostURL() {
|
|
55448
55463
|
return "".concat(document.location.protocol, "//").concat(document.location.host);
|
|
55449
|
-
};var _excluded$
|
|
55464
|
+
};var _excluded$a = ["uuid"];
|
|
55450
55465
|
var COLLIDER_TYPES = COLLIDER_TYPES$1;
|
|
55451
55466
|
var getBoxDescriptionForElement = getBoxDescriptionForElement$1,
|
|
55452
55467
|
extractPositionAndQuaternion = extractPositionAndQuaternion$1,
|
|
@@ -55520,7 +55535,7 @@ var Physics = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
55520
55535
|
|
|
55521
55536
|
_defineProperty$1(_assertThisInitialized(_this), "handleBodyUpdate", function (_ref3) {
|
|
55522
55537
|
var uuid = _ref3.uuid,
|
|
55523
|
-
data = _objectWithoutProperties(_ref3, _excluded$
|
|
55538
|
+
data = _objectWithoutProperties(_ref3, _excluded$a);
|
|
55524
55539
|
|
|
55525
55540
|
var element = Universe$1.getByUUID(uuid);
|
|
55526
55541
|
|
|
@@ -55902,9 +55917,8 @@ var Physics$1 = new Physics();var ENTITY_TYPES = {
|
|
|
55902
55917
|
},
|
|
55903
55918
|
AUDIO: {
|
|
55904
55919
|
DEFAULT: 'AUDIO.DEFAULT',
|
|
55905
|
-
AMBIENT: 'AUDIO.AMBIENT',
|
|
55906
55920
|
DIRECTIONAL: 'AUDIO.DIRECTIONAL',
|
|
55907
|
-
|
|
55921
|
+
AMBIENT: 'AUDIO.AMBIENT'
|
|
55908
55922
|
},
|
|
55909
55923
|
MODEL: 'MODEL',
|
|
55910
55924
|
SPRITE: 'SPRITE',
|
|
@@ -55928,6 +55942,9 @@ var ENTITY_EVENTS = {
|
|
|
55928
55942
|
ANIMATION: {
|
|
55929
55943
|
LOOP: 'LOOP',
|
|
55930
55944
|
FINISHED: 'FINISHED'
|
|
55945
|
+
},
|
|
55946
|
+
AUDIO: {
|
|
55947
|
+
ENDED: 'ended'
|
|
55931
55948
|
}
|
|
55932
55949
|
};
|
|
55933
55950
|
var DEFAULT_TAG = 'all';var Scene = /*#__PURE__*/function () {
|
|
@@ -57396,7 +57413,7 @@ function applyMiddleware() {
|
|
|
57396
57413
|
|
|
57397
57414
|
var thunk = createThunkMiddleware();
|
|
57398
57415
|
thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
|
|
57399
|
-
var version$1 = "3.
|
|
57416
|
+
var version$1 = "3.21.0";
|
|
57400
57417
|
var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
|
|
57401
57418
|
var main = "dist/mage.js";
|
|
57402
57419
|
var author$1 = {
|
|
@@ -58665,7 +58682,7 @@ if (!self.fetch) {
|
|
|
58665
58682
|
self.Headers = Headers;
|
|
58666
58683
|
self.Request = Request;
|
|
58667
58684
|
self.Response = Response;
|
|
58668
|
-
}var _excluded$
|
|
58685
|
+
}var _excluded$9 = ["wheels", "accelerationKey", "brakingKey", "rightKey", "leftKey", "debug", "autostart"];
|
|
58669
58686
|
|
|
58670
58687
|
var BaseCar = /*#__PURE__*/function (_BaseScript) {
|
|
58671
58688
|
_inherits(BaseCar, _BaseScript);
|
|
@@ -58693,7 +58710,7 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
|
|
|
58693
58710
|
options.debug;
|
|
58694
58711
|
var _options$autostart = options.autostart,
|
|
58695
58712
|
autostart = _options$autostart === void 0 ? true : _options$autostart,
|
|
58696
|
-
physicsOptions = _objectWithoutProperties(options, _excluded$
|
|
58713
|
+
physicsOptions = _objectWithoutProperties(options, _excluded$9);
|
|
58697
58714
|
|
|
58698
58715
|
this.car = element;
|
|
58699
58716
|
this.wheels = wheels;
|
|
@@ -59540,6 +59557,17 @@ var hasMaterial = function hasMaterial(mesh) {
|
|
|
59540
59557
|
var hasGeometry = function hasGeometry(mesh) {
|
|
59541
59558
|
return Boolean(mesh.geometry);
|
|
59542
59559
|
};
|
|
59560
|
+
var applyMaterialChange = function applyMaterialChange(elementBody, changeCallback) {
|
|
59561
|
+
if (hasMaterial(elementBody)) {
|
|
59562
|
+
processMaterial(elementBody.material, changeCallback);
|
|
59563
|
+
} else {
|
|
59564
|
+
elementBody.traverse(function (child) {
|
|
59565
|
+
if (hasMaterial(child)) {
|
|
59566
|
+
processMaterial(child.material, changeCallback);
|
|
59567
|
+
}
|
|
59568
|
+
});
|
|
59569
|
+
}
|
|
59570
|
+
};
|
|
59543
59571
|
var processMaterial = function processMaterial(material, callback) {
|
|
59544
59572
|
return Array.isArray(material) ? material.map(callback) : callback(material);
|
|
59545
59573
|
};
|
|
@@ -59627,7 +59655,7 @@ var EASING_EVENTS = {
|
|
|
59627
59655
|
UPDATE: 'update',
|
|
59628
59656
|
COMPLETE: 'complete'
|
|
59629
59657
|
};
|
|
59630
|
-
var FUNCTIONS = _objectSpread2$1({},
|
|
59658
|
+
var FUNCTIONS = _objectSpread2$1({}, between.Easing);
|
|
59631
59659
|
var tweenTo = function tweenTo(origin, target) {
|
|
59632
59660
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
59633
59661
|
return new Promise(function (resolve) {
|
|
@@ -59642,7 +59670,7 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59642
59670
|
} : _options$onUpdate,
|
|
59643
59671
|
_options$repeat = options.repeat,
|
|
59644
59672
|
repeat = _options$repeat === void 0 ? undefined : _options$repeat;
|
|
59645
|
-
var tween = new
|
|
59673
|
+
var tween = new between(origin, target).time(time).easing(easing).on(EASING_EVENTS.UPDATE, onUpdate);
|
|
59646
59674
|
var infinite = loop && !repeat;
|
|
59647
59675
|
|
|
59648
59676
|
var onComplete = function onComplete() {
|
|
@@ -59668,16 +59696,16 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59668
59696
|
function Entity() {
|
|
59669
59697
|
var _this;
|
|
59670
59698
|
|
|
59671
|
-
var
|
|
59672
|
-
_ref$serializable = _ref.serializable,
|
|
59673
|
-
serializable = _ref$serializable === void 0 ? true : _ref$serializable,
|
|
59674
|
-
_ref$tag = _ref.tag,
|
|
59675
|
-
tag = _ref$tag === void 0 ? '' : _ref$tag,
|
|
59676
|
-
_ref$tags = _ref.tags,
|
|
59677
|
-
tags = _ref$tags === void 0 ? [] : _ref$tags;
|
|
59699
|
+
var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
59678
59700
|
|
|
59679
59701
|
_classCallCheck(this, Entity);
|
|
59680
59702
|
|
|
59703
|
+
var _options$serializable = _options.serializable,
|
|
59704
|
+
serializable = _options$serializable === void 0 ? true : _options$serializable,
|
|
59705
|
+
_options$tag = _options.tag,
|
|
59706
|
+
tag = _options$tag === void 0 ? '' : _options$tag,
|
|
59707
|
+
_options$tags = _options.tags,
|
|
59708
|
+
tags = _options$tags === void 0 ? [] : _options$tags;
|
|
59681
59709
|
_this = _super.call(this);
|
|
59682
59710
|
|
|
59683
59711
|
_defineProperty$1(_assertThisInitialized(_this), "getBodyByName", function (name) {
|
|
@@ -59744,11 +59772,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59744
59772
|
return Object.values(ENTITY_TYPES.EFFECT).includes(_this.getEntityType());
|
|
59745
59773
|
});
|
|
59746
59774
|
|
|
59747
|
-
_defineProperty$1(_assertThisInitialized(_this), "setQuaternion", function (
|
|
59748
|
-
var x =
|
|
59749
|
-
y =
|
|
59750
|
-
z =
|
|
59751
|
-
w =
|
|
59775
|
+
_defineProperty$1(_assertThisInitialized(_this), "setQuaternion", function (_ref) {
|
|
59776
|
+
var x = _ref.x,
|
|
59777
|
+
y = _ref.y,
|
|
59778
|
+
z = _ref.z,
|
|
59779
|
+
w = _ref.w;
|
|
59752
59780
|
|
|
59753
59781
|
_this.body.quaternion.set(x, y, z, w);
|
|
59754
59782
|
});
|
|
@@ -59759,6 +59787,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59759
59787
|
}
|
|
59760
59788
|
});
|
|
59761
59789
|
|
|
59790
|
+
_this.options = _objectSpread2$1(_objectSpread2$1({}, _options), {}, {
|
|
59791
|
+
serializable: serializable,
|
|
59792
|
+
tag: tag,
|
|
59793
|
+
tags: tags
|
|
59794
|
+
});
|
|
59762
59795
|
_this.scripts = [];
|
|
59763
59796
|
_this.tags = [];
|
|
59764
59797
|
_this.children = [];
|
|
@@ -59827,8 +59860,8 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59827
59860
|
}, {
|
|
59828
59861
|
key: "setBody",
|
|
59829
59862
|
value: function setBody() {
|
|
59830
|
-
var
|
|
59831
|
-
body =
|
|
59863
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
59864
|
+
body = _ref2.body;
|
|
59832
59865
|
|
|
59833
59866
|
this.body = body;
|
|
59834
59867
|
}
|
|
@@ -59854,11 +59887,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59854
59887
|
|
|
59855
59888
|
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getBody();
|
|
59856
59889
|
|
|
59857
|
-
var
|
|
59858
|
-
|
|
59859
|
-
waitForBody =
|
|
59860
|
-
|
|
59861
|
-
waitForBodyMaxRetries =
|
|
59890
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
59891
|
+
_ref3$waitForBody = _ref3.waitForBody,
|
|
59892
|
+
waitForBody = _ref3$waitForBody === void 0 ? 0 : _ref3$waitForBody,
|
|
59893
|
+
_ref3$waitForBodyMaxR = _ref3.waitForBodyMaxRetries,
|
|
59894
|
+
waitForBodyMaxRetries = _ref3$waitForBodyMaxR === void 0 ? 1 : _ref3$waitForBodyMaxR;
|
|
59862
59895
|
|
|
59863
59896
|
if (this.hasBody()) {
|
|
59864
59897
|
var _add = function _add(toAdd) {
|
|
@@ -60015,10 +60048,10 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60015
60048
|
var _this4 = this;
|
|
60016
60049
|
|
|
60017
60050
|
if (this.hasScripts()) {
|
|
60018
|
-
this.scripts.forEach(function (
|
|
60019
|
-
var script =
|
|
60020
|
-
enabled =
|
|
60021
|
-
options =
|
|
60051
|
+
this.scripts.forEach(function (_ref4) {
|
|
60052
|
+
var script = _ref4.script,
|
|
60053
|
+
enabled = _ref4.enabled,
|
|
60054
|
+
options = _ref4.options;
|
|
60022
60055
|
|
|
60023
60056
|
if (enabled) {
|
|
60024
60057
|
script.start(_this4, options);
|
|
@@ -60032,9 +60065,9 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60032
60065
|
key: "update",
|
|
60033
60066
|
value: function update(dt) {
|
|
60034
60067
|
if (this.hasScripts()) {
|
|
60035
|
-
this.scripts.forEach(function (
|
|
60036
|
-
var script =
|
|
60037
|
-
enabled =
|
|
60068
|
+
this.scripts.forEach(function (_ref5) {
|
|
60069
|
+
var script = _ref5.script,
|
|
60070
|
+
enabled = _ref5.enabled;
|
|
60038
60071
|
|
|
60039
60072
|
if (script && enabled) {
|
|
60040
60073
|
script.update(dt);
|
|
@@ -60046,9 +60079,9 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60046
60079
|
key: "onPhysicsUpdate",
|
|
60047
60080
|
value: function onPhysicsUpdate(dt) {
|
|
60048
60081
|
if (this.hasScripts()) {
|
|
60049
|
-
this.scripts.forEach(function (
|
|
60050
|
-
var script =
|
|
60051
|
-
enabled =
|
|
60082
|
+
this.scripts.forEach(function (_ref6) {
|
|
60083
|
+
var script = _ref6.script,
|
|
60084
|
+
enabled = _ref6.enabled;
|
|
60052
60085
|
|
|
60053
60086
|
if (script && enabled) {
|
|
60054
60087
|
script.physicsUpdate(dt);
|
|
@@ -60293,13 +60326,13 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60293
60326
|
}
|
|
60294
60327
|
}, {
|
|
60295
60328
|
key: "translate",
|
|
60296
|
-
value: function translate(
|
|
60297
|
-
var
|
|
60298
|
-
x =
|
|
60299
|
-
|
|
60300
|
-
y =
|
|
60301
|
-
|
|
60302
|
-
z =
|
|
60329
|
+
value: function translate(_ref7) {
|
|
60330
|
+
var _ref7$x = _ref7.x,
|
|
60331
|
+
x = _ref7$x === void 0 ? 0 : _ref7$x,
|
|
60332
|
+
_ref7$y = _ref7.y,
|
|
60333
|
+
y = _ref7$y === void 0 ? 0 : _ref7$y,
|
|
60334
|
+
_ref7$z = _ref7.z,
|
|
60335
|
+
z = _ref7$z === void 0 ? 0 : _ref7$z;
|
|
60303
60336
|
|
|
60304
60337
|
if (this.hasBody()) {
|
|
60305
60338
|
this.body.translateX(x);
|
|
@@ -60475,10 +60508,10 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60475
60508
|
}, {
|
|
60476
60509
|
key: "mapScriptsToJSON",
|
|
60477
60510
|
value: function mapScriptsToJSON() {
|
|
60478
|
-
this.scripts.reduce(function (acc,
|
|
60479
|
-
var name =
|
|
60480
|
-
|
|
60481
|
-
options =
|
|
60511
|
+
this.scripts.reduce(function (acc, _ref8) {
|
|
60512
|
+
var name = _ref8.name,
|
|
60513
|
+
_ref8$options = _ref8.options,
|
|
60514
|
+
options = _ref8$options === void 0 ? {} : _ref8$options;
|
|
60482
60515
|
acc.names.push(name);
|
|
60483
60516
|
acc.options.push(options);
|
|
60484
60517
|
return acc;
|
|
@@ -60637,7 +60670,7 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60637
60670
|
var MATERIAL_TEXTURE_MAP = (_MATERIAL_TEXTURE_MAP = {}, _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.BASIC, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.LAMBERT, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.PHONG, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.DEPTH, [TEXTURES.ALPHA, TEXTURES.MAP, TEXTURES.DISPLACEMENT]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.STANDARD, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL, TEXTURES.METALNESS, TEXTURES.ROUGHNESS]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.THREE_TOON, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.EMISSIVE, TEXTURES.GRADIENT, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.NORMAL]), _MATERIAL_TEXTURE_MAP);
|
|
60638
60671
|
var isTextureMapAllowedForMaterial = function isTextureMapAllowedForMaterial(materialType, textureType) {
|
|
60639
60672
|
return MATERIAL_TEXTURE_MAP[materialType] && MATERIAL_TEXTURE_MAP[materialType].includes(textureType);
|
|
60640
|
-
};var _excluded$
|
|
60673
|
+
};var _excluded$8 = ["position", "quaternion"],
|
|
60641
60674
|
_excluded2 = ["applyPhysicsUpdate"],
|
|
60642
60675
|
_excluded3 = ["dt", "event"];
|
|
60643
60676
|
var COLLIDER_TAG = 'collider';
|
|
@@ -60827,7 +60860,7 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
60827
60860
|
_defineProperty$1(_assertThisInitialized(_this), "handlePhysicsUpdate", function (_ref6) {
|
|
60828
60861
|
var position = _ref6.position,
|
|
60829
60862
|
quaternion = _ref6.quaternion,
|
|
60830
|
-
data = _objectWithoutProperties(_ref6, _excluded$
|
|
60863
|
+
data = _objectWithoutProperties(_ref6, _excluded$8);
|
|
60831
60864
|
|
|
60832
60865
|
_this.setPosition(position);
|
|
60833
60866
|
|
|
@@ -61172,18 +61205,12 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61172
61205
|
}, {
|
|
61173
61206
|
key: "setColor",
|
|
61174
61207
|
value: function setColor(color) {
|
|
61175
|
-
var
|
|
61208
|
+
var _setColor = function _setColor(material) {
|
|
61209
|
+
return material.color = new Color$1(color);
|
|
61210
|
+
};
|
|
61176
61211
|
|
|
61177
61212
|
if (color) {
|
|
61178
|
-
|
|
61179
|
-
this.body.material.color = new Color$1(color);
|
|
61180
|
-
} else {
|
|
61181
|
-
this.body.traverse(function (child) {
|
|
61182
|
-
if (hasMaterial(child) && !_this2.isParentOf(child)) {
|
|
61183
|
-
child.material.color = new Color$1(color);
|
|
61184
|
-
}
|
|
61185
|
-
});
|
|
61186
|
-
}
|
|
61213
|
+
applyMaterialChange(this.getBody(), _setColor);
|
|
61187
61214
|
} else {
|
|
61188
61215
|
console.warn(ELEMENT_SET_COLOR_MISSING_COLOR);
|
|
61189
61216
|
}
|
|
@@ -61229,23 +61256,15 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61229
61256
|
wrap = _options$wrap === void 0 ? RepeatWrapping$1 : _options$wrap;
|
|
61230
61257
|
this.recordTexture(textureId, textureType);
|
|
61231
61258
|
|
|
61232
|
-
var applyTextureTo = function applyTextureTo(
|
|
61259
|
+
var applyTextureTo = function applyTextureTo(material) {
|
|
61233
61260
|
var texture = Images$1.get(textureId);
|
|
61234
61261
|
texture.wrapS = wrap;
|
|
61235
61262
|
texture.wrapT = wrap;
|
|
61236
61263
|
texture.repeat.set(repeat.x, repeat.y);
|
|
61237
|
-
|
|
61264
|
+
material[textureType] = texture;
|
|
61238
61265
|
};
|
|
61239
61266
|
|
|
61240
|
-
|
|
61241
|
-
applyTextureTo(this.getBody());
|
|
61242
|
-
} else {
|
|
61243
|
-
this.getBody().traverse(function (child) {
|
|
61244
|
-
if (hasMaterial(child)) {
|
|
61245
|
-
applyTextureTo(child);
|
|
61246
|
-
}
|
|
61247
|
-
});
|
|
61248
|
-
}
|
|
61267
|
+
applyMaterialChange(this.getBody(), applyTextureTo);
|
|
61249
61268
|
}
|
|
61250
61269
|
}
|
|
61251
61270
|
}, {
|
|
@@ -61295,64 +61314,58 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61295
61314
|
}, {
|
|
61296
61315
|
key: "setOpacity",
|
|
61297
61316
|
value: function setOpacity() {
|
|
61298
|
-
var
|
|
61317
|
+
var _this2 = this;
|
|
61299
61318
|
|
|
61300
61319
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;
|
|
61301
61320
|
var opacity = clamp(value, 0, 1);
|
|
61302
61321
|
this.opacity = opacity;
|
|
61303
61322
|
|
|
61304
|
-
|
|
61305
|
-
|
|
61306
|
-
|
|
61307
|
-
}
|
|
61308
|
-
|
|
61309
|
-
|
|
61310
|
-
child.material.transparent = true;
|
|
61311
|
-
child.material.opacity = opacity;
|
|
61312
|
-
}
|
|
61313
|
-
});
|
|
61314
|
-
}
|
|
61323
|
+
var _setOpacity = function _setOpacity(material) {
|
|
61324
|
+
material.transparent = true;
|
|
61325
|
+
material.opacity = _this2.opacity;
|
|
61326
|
+
};
|
|
61327
|
+
|
|
61328
|
+
applyMaterialChange(this.getBody(), _setOpacity);
|
|
61315
61329
|
}
|
|
61316
61330
|
}, {
|
|
61317
61331
|
key: "fadeTo",
|
|
61318
|
-
value: function fadeTo(
|
|
61319
|
-
var
|
|
61332
|
+
value: function fadeTo() {
|
|
61333
|
+
var _this3 = this;
|
|
61320
61334
|
|
|
61321
|
-
|
|
61322
|
-
|
|
61323
|
-
|
|
61324
|
-
|
|
61325
|
-
|
|
61335
|
+
var opacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
61336
|
+
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
61337
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
61338
|
+
|
|
61339
|
+
var onUpdate = function onUpdate(value) {
|
|
61340
|
+
return !_this3.isDisposed() && _this3.setOpacity(value);
|
|
61341
|
+
};
|
|
61342
|
+
|
|
61343
|
+
return tweenTo(this.opacity, clamp(opacity, 0, 1), _objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
61344
|
+
time: time,
|
|
61345
|
+
onUpdate: onUpdate
|
|
61346
|
+
}));
|
|
61326
61347
|
}
|
|
61327
61348
|
}, {
|
|
61328
61349
|
key: "setWireframe",
|
|
61329
61350
|
value: function setWireframe() {
|
|
61330
61351
|
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
61331
61352
|
|
|
61332
|
-
|
|
61333
|
-
|
|
61334
|
-
}
|
|
61335
|
-
|
|
61336
|
-
|
|
61337
|
-
child.material.wireframe = flag;
|
|
61338
|
-
}
|
|
61339
|
-
});
|
|
61340
|
-
}
|
|
61353
|
+
var _setWireframe = function _setWireframe(material) {
|
|
61354
|
+
return material.wireframe = flag;
|
|
61355
|
+
};
|
|
61356
|
+
|
|
61357
|
+
applyMaterialChange(this.getBody(), _setWireframe);
|
|
61341
61358
|
}
|
|
61342
61359
|
}, {
|
|
61343
61360
|
key: "setWireframeLineWidth",
|
|
61344
61361
|
value: function setWireframeLineWidth() {
|
|
61345
61362
|
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
61346
61363
|
|
|
61347
|
-
|
|
61348
|
-
|
|
61349
|
-
}
|
|
61350
|
-
|
|
61351
|
-
|
|
61352
|
-
child.material.wireframeLinewidth = width;
|
|
61353
|
-
}
|
|
61354
|
-
});
|
|
61355
|
-
}
|
|
61364
|
+
var _setWireframeLineWidth = function _setWireframeLineWidth(material) {
|
|
61365
|
+
material.wireframeLinewidth = width;
|
|
61366
|
+
};
|
|
61367
|
+
|
|
61368
|
+
applyMaterialChange(this.getBody(), _setWireframeLineWidth);
|
|
61356
61369
|
}
|
|
61357
61370
|
}, {
|
|
61358
61371
|
key: "disposeBody",
|
|
@@ -61939,7 +61952,7 @@ var Plane = /*#__PURE__*/function (_Element) {
|
|
|
61939
61952
|
}
|
|
61940
61953
|
|
|
61941
61954
|
return Box;
|
|
61942
|
-
}(Element$1);var _excluded$
|
|
61955
|
+
}(Element$1);var _excluded$7 = ["anisotropy"];
|
|
61943
61956
|
|
|
61944
61957
|
var validateAnisotropy = function validateAnisotropy(anisotropy) {
|
|
61945
61958
|
var max = Scene$1.getRenderer().capabilities.getMaxAnisotropy();
|
|
@@ -61965,7 +61978,7 @@ var Sprite = /*#__PURE__*/function (_Element) {
|
|
|
61965
61978
|
|
|
61966
61979
|
var _options$anisotropy = options.anisotropy,
|
|
61967
61980
|
anisotropy = _options$anisotropy === void 0 ? 1 : _options$anisotropy,
|
|
61968
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
61981
|
+
rest = _objectWithoutProperties(options, _excluded$7);
|
|
61969
61982
|
|
|
61970
61983
|
var texture = Images$1.get(spriteTexture);
|
|
61971
61984
|
texture.anisotropy = validateAnisotropy(anisotropy);
|
|
@@ -68229,9 +68242,9 @@ var connect = createConnect();var BaseUI = function BaseUI() {
|
|
|
68229
68242
|
return null;
|
|
68230
68243
|
};var TIME_FOR_UPDATE = 5;
|
|
68231
68244
|
var VOLUME = 2;
|
|
68232
|
-
var
|
|
68233
|
-
|
|
68234
|
-
|
|
68245
|
+
var DEFAULT_AUDIO_NODE_VOLUME = 5;
|
|
68246
|
+
var DEFAULT_AUDIO_NODE_RAMP_TIME = 100; // value in ms
|
|
68247
|
+
|
|
68235
68248
|
var AUDIO_RAMPS = {
|
|
68236
68249
|
LINEAR: 'LINEAR',
|
|
68237
68250
|
EXPONENTIAL: 'EXPONENTIAL'
|
|
@@ -68307,6 +68320,11 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68307
68320
|
value: function hasContext() {
|
|
68308
68321
|
return !!this.context;
|
|
68309
68322
|
}
|
|
68323
|
+
}, {
|
|
68324
|
+
key: "hasSounds",
|
|
68325
|
+
value: function hasSounds() {
|
|
68326
|
+
return this.sounds.length > 0;
|
|
68327
|
+
}
|
|
68310
68328
|
}, {
|
|
68311
68329
|
key: "createAudioContext",
|
|
68312
68330
|
value: function createAudioContext() {
|
|
@@ -68334,6 +68352,8 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68334
68352
|
if (this.context) {
|
|
68335
68353
|
return this.context.destination;
|
|
68336
68354
|
}
|
|
68355
|
+
|
|
68356
|
+
console.log(AUDIO_CONTEXT_NOT_AVAILABLE);
|
|
68337
68357
|
}
|
|
68338
68358
|
}, {
|
|
68339
68359
|
key: "getVolume",
|
|
@@ -68341,6 +68361,8 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68341
68361
|
if (this.masterVolumeNode) {
|
|
68342
68362
|
return this.masterVolumeNode.gain.value;
|
|
68343
68363
|
}
|
|
68364
|
+
|
|
68365
|
+
console.log(AUDIO_CONTEXT_NOT_AVAILABLE);
|
|
68344
68366
|
}
|
|
68345
68367
|
}, {
|
|
68346
68368
|
key: "getMasterVolumeNode",
|
|
@@ -68365,33 +68387,33 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68365
68387
|
}, {
|
|
68366
68388
|
key: "updateListenerPosition",
|
|
68367
68389
|
value: function updateListenerPosition() {
|
|
68368
|
-
//now handling listener
|
|
68369
68390
|
Scene$1.getCameraBody().updateMatrixWorld();
|
|
68370
68391
|
var p = new Vector3$1();
|
|
68371
|
-
p.setFromMatrixPosition(Scene$1.getCameraBody().matrixWorld);
|
|
68372
|
-
|
|
68373
|
-
this.context.listener.
|
|
68392
|
+
p.setFromMatrixPosition(Scene$1.getCameraBody().matrixWorld);
|
|
68393
|
+
this.context.listener.positionX.setValueAtTime(p.x, this.context.currentTime);
|
|
68394
|
+
this.context.listener.positionY.setValueAtTime(p.y, this.context.currentTime);
|
|
68395
|
+
this.context.listener.positionZ.setValueAtTime(p.z, this.context.currentTime);
|
|
68374
68396
|
}
|
|
68375
68397
|
}, {
|
|
68376
68398
|
key: "updatelistenerOrientation",
|
|
68377
68399
|
value: function updatelistenerOrientation() {
|
|
68378
|
-
//this is to add up and down vector to our camera
|
|
68379
|
-
// The camera's world matrix is named "matrix".
|
|
68380
68400
|
var m = Scene$1.getCameraBody().matrix;
|
|
68381
68401
|
var mx = m.elements[12],
|
|
68382
68402
|
my = m.elements[13],
|
|
68383
68403
|
mz = m.elements[14];
|
|
68384
|
-
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
68385
|
-
|
|
68404
|
+
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
68386
68405
|
var vec = new Vector3$1(0, 0, 1);
|
|
68387
68406
|
vec.applyMatrix4(m);
|
|
68388
|
-
vec.normalize();
|
|
68389
|
-
|
|
68407
|
+
vec.normalize();
|
|
68390
68408
|
var up = new Vector3$1(0, -1, 0);
|
|
68391
68409
|
up.applyMatrix4(m);
|
|
68392
|
-
up.normalize();
|
|
68393
|
-
|
|
68394
|
-
this.context.listener.
|
|
68410
|
+
up.normalize();
|
|
68411
|
+
this.context.listener.forwardX.setValueAtTime(vec.x, this.context.currentTime);
|
|
68412
|
+
this.context.listener.forwardY.setValueAtTime(vec.y, this.context.currentTime);
|
|
68413
|
+
this.context.listener.forwardZ.setValueAtTime(vec.z, this.context.currentTime);
|
|
68414
|
+
this.context.listener.upX.setValueAtTime(up.x, this.context.currentTime);
|
|
68415
|
+
this.context.listener.upY.setValueAtTime(up.y, this.context.currentTime);
|
|
68416
|
+
this.context.listener.upZ.setValueAtTime(up.z, this.context.currentTime);
|
|
68395
68417
|
m.elements[12] = mx;
|
|
68396
68418
|
m.elements[13] = my;
|
|
68397
68419
|
m.elements[14] = mz;
|
|
@@ -68410,13 +68432,17 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68410
68432
|
key: "update",
|
|
68411
68433
|
value: function update(dt) {
|
|
68412
68434
|
if (!this.hasContext()) return;
|
|
68435
|
+
|
|
68436
|
+
if (this.hasSounds()) {
|
|
68437
|
+
this.updateListenerPosition();
|
|
68438
|
+
this.updatelistenerOrientation();
|
|
68439
|
+
}
|
|
68440
|
+
|
|
68413
68441
|
var start = new Date();
|
|
68414
68442
|
|
|
68415
68443
|
for (var index in this.sounds) {
|
|
68416
68444
|
var sound = this.sounds[index];
|
|
68417
68445
|
sound.update(dt);
|
|
68418
|
-
this.updateListenerPosition();
|
|
68419
|
-
this.updatelistenerOrientation();
|
|
68420
68446
|
if (+new Date() - start > TIME_FOR_UPDATE) break;
|
|
68421
68447
|
}
|
|
68422
68448
|
}
|
|
@@ -82336,7 +82362,7 @@ var Stats$1 = new Stats();var Loader = /*#__PURE__*/function () {
|
|
|
82336
82362
|
}]);
|
|
82337
82363
|
|
|
82338
82364
|
return Loader;
|
|
82339
|
-
}();var _excluded$
|
|
82365
|
+
}();var _excluded$6 = ["mesh", "scripts", "texture"];
|
|
82340
82366
|
var MeshLoader = /*#__PURE__*/function (_Loader) {
|
|
82341
82367
|
_inherits(MeshLoader, _Loader);
|
|
82342
82368
|
|
|
@@ -82362,7 +82388,7 @@ var MeshLoader = /*#__PURE__*/function (_Loader) {
|
|
|
82362
82388
|
var mesh = _ref.mesh,
|
|
82363
82389
|
scripts = _ref.scripts,
|
|
82364
82390
|
texture = _ref.texture,
|
|
82365
|
-
opts = _objectWithoutProperties(_ref, _excluded$
|
|
82391
|
+
opts = _objectWithoutProperties(_ref, _excluded$6);
|
|
82366
82392
|
|
|
82367
82393
|
return _this.loadMesh(_this.parseMesh(mesh), scripts, texture, opts);
|
|
82368
82394
|
});
|
|
@@ -82895,9 +82921,11 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
82895
82921
|
|
|
82896
82922
|
var _super = _createSuper(PointLight);
|
|
82897
82923
|
|
|
82898
|
-
function PointLight(
|
|
82924
|
+
function PointLight() {
|
|
82899
82925
|
var _this;
|
|
82900
82926
|
|
|
82927
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
82928
|
+
|
|
82901
82929
|
_classCallCheck(this, PointLight);
|
|
82902
82930
|
|
|
82903
82931
|
var _options$color = options.color,
|
|
@@ -85488,7 +85516,21 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
|
|
|
85488
85516
|
}
|
|
85489
85517
|
|
|
85490
85518
|
return Fountain;
|
|
85491
|
-
}(ParticleEmitter);var
|
|
85519
|
+
}(ParticleEmitter);var three_proton_min = {exports: {}};var require$$0 = /*@__PURE__*/getAugmentedNamespace(three_module);/*!
|
|
85520
|
+
* three.proton v0.2.0
|
|
85521
|
+
* https://github.com/drawcall/three.proton
|
|
85522
|
+
*
|
|
85523
|
+
* Copyright 2011-2020, ajiemath
|
|
85524
|
+
* Licensed under the MIT license
|
|
85525
|
+
* http://www.opensource.org/licenses/mit-license
|
|
85526
|
+
*
|
|
85527
|
+
*/
|
|
85528
|
+
|
|
85529
|
+
(function (module, exports) {
|
|
85530
|
+
(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});
|
|
85531
|
+
}(three_proton_min));
|
|
85532
|
+
|
|
85533
|
+
var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/function (_Entity) {
|
|
85492
85534
|
_inherits(ParticleEmitterGroup, _Entity);
|
|
85493
85535
|
|
|
85494
85536
|
var _super = _createSuper(ParticleEmitterGroup);
|
|
@@ -85667,7 +85709,7 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
|
|
|
85667
85709
|
}]);
|
|
85668
85710
|
|
|
85669
85711
|
return ParticleEmitterGroup;
|
|
85670
|
-
}(Entity);var _excluded$
|
|
85712
|
+
}(Entity);var _excluded$5 = ["initializers", "behaviours", "texture", "color", "rate"];
|
|
85671
85713
|
var DEFAULT_PARTICLE_COLOR = PALETTES.BASE.BLACK;
|
|
85672
85714
|
var SYSTEM_DISPOSE_TIMEOUT = 700;
|
|
85673
85715
|
|
|
@@ -85692,7 +85734,7 @@ var ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
|
|
|
85692
85734
|
_options$color = options.color,
|
|
85693
85735
|
color = _options$color === void 0 ? DEFAULT_PARTICLE_COLOR : _options$color,
|
|
85694
85736
|
rate = options.rate,
|
|
85695
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
85737
|
+
rest = _objectWithoutProperties(options, _excluded$5);
|
|
85696
85738
|
|
|
85697
85739
|
var parsedOptions = _objectSpread2$1({
|
|
85698
85740
|
initializers: initializers,
|
|
@@ -85901,7 +85943,7 @@ var Explosion = /*#__PURE__*/function (_ParticleEmitterGroup) {
|
|
|
85901
85943
|
}
|
|
85902
85944
|
|
|
85903
85945
|
return Explosion;
|
|
85904
|
-
}(ParticleEmitterGroup);var _excluded$
|
|
85946
|
+
}(ParticleEmitterGroup);var _excluded$4 = ["texture", "direction", "size", "strength", "colors"];
|
|
85905
85947
|
|
|
85906
85948
|
var getFireRate = function getFireRate() {
|
|
85907
85949
|
return new Proton.Rate(new Proton.Span(10, 15), new Proton.Span(.05, .1));
|
|
@@ -85933,7 +85975,7 @@ var Fire = /*#__PURE__*/function (_ProtonParticleEmitte) {
|
|
|
85933
85975
|
_options$strength = options.strength,
|
|
85934
85976
|
strength = _options$strength === void 0 ? 100 : _options$strength,
|
|
85935
85977
|
colors = options.colors,
|
|
85936
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
85978
|
+
rest = _objectWithoutProperties(options, _excluded$4);
|
|
85937
85979
|
|
|
85938
85980
|
var fireOptions = _objectSpread2$1({
|
|
85939
85981
|
rate: getFireRate(),
|
|
@@ -90107,7 +90149,7 @@ var unmount = function unmount() {
|
|
|
90107
90149
|
render(null, container); // removing the container as well
|
|
90108
90150
|
|
|
90109
90151
|
removeElement(id);
|
|
90110
|
-
};var _excluded$
|
|
90152
|
+
};var _excluded$3 = ["Component", "format", "width", "height"];
|
|
90111
90153
|
|
|
90112
90154
|
var Label = /*#__PURE__*/function (_Element) {
|
|
90113
90155
|
_inherits(Label, _Element);
|
|
@@ -90122,7 +90164,7 @@ var Label = /*#__PURE__*/function (_Element) {
|
|
|
90122
90164
|
format = _ref$format === void 0 ? 'png' : _ref$format,
|
|
90123
90165
|
_width = _ref.width,
|
|
90124
90166
|
_height = _ref.height,
|
|
90125
|
-
options = _objectWithoutProperties(_ref, _excluded$
|
|
90167
|
+
options = _objectWithoutProperties(_ref, _excluded$3);
|
|
90126
90168
|
|
|
90127
90169
|
_classCallCheck(this, Label);
|
|
90128
90170
|
|
|
@@ -90316,34 +90358,109 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90316
90358
|
}
|
|
90317
90359
|
|
|
90318
90360
|
return Cone;
|
|
90319
|
-
}(Element$1);var
|
|
90320
|
-
|
|
90321
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
90361
|
+
}(Element$1);var Sound = /*#__PURE__*/function (_Entity) {
|
|
90362
|
+
_inherits(Sound, _Entity);
|
|
90322
90363
|
|
|
90323
|
-
|
|
90364
|
+
var _super = _createSuper(Sound);
|
|
90324
90365
|
|
|
90325
|
-
|
|
90326
|
-
|
|
90327
|
-
|
|
90328
|
-
|
|
90329
|
-
|
|
90330
|
-
this
|
|
90331
|
-
|
|
90366
|
+
function Sound() {
|
|
90367
|
+
var _this;
|
|
90368
|
+
|
|
90369
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90370
|
+
|
|
90371
|
+
_classCallCheck(this, Sound);
|
|
90372
|
+
|
|
90373
|
+
var source = options.source,
|
|
90374
|
+
_options$loop = options.loop,
|
|
90375
|
+
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90376
|
+
loopStart = options.loopStart,
|
|
90377
|
+
loopEnd = options.loopEnd,
|
|
90378
|
+
autoplay = options.autoplay,
|
|
90379
|
+
reconnectOnReset = options.reconnectOnReset,
|
|
90380
|
+
_options$name = options.name,
|
|
90381
|
+
name = _options$name === void 0 ? generateRandomName('sound') : _options$name;
|
|
90382
|
+
_this = _super.call(this, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
90383
|
+
source: source,
|
|
90384
|
+
loop: loop,
|
|
90385
|
+
loopStart: loopStart,
|
|
90386
|
+
loopEnd: loopEnd,
|
|
90387
|
+
autoplay: autoplay,
|
|
90388
|
+
reconnectOnReset: reconnectOnReset,
|
|
90389
|
+
name: name
|
|
90390
|
+
}));
|
|
90391
|
+
|
|
90392
|
+
_defineProperty$1(_assertThisInitialized(_this), "reset", function () {
|
|
90393
|
+
_this.playing = false;
|
|
90394
|
+
|
|
90395
|
+
_this.disconnect();
|
|
90396
|
+
|
|
90397
|
+
_this.setupAudio();
|
|
90398
|
+
|
|
90399
|
+
_this.connect();
|
|
90400
|
+
});
|
|
90401
|
+
|
|
90402
|
+
_this.source = source;
|
|
90403
|
+
_this.loop = loop;
|
|
90404
|
+
_this.loopStart = loopStart;
|
|
90405
|
+
_this.loopEnd = loopEnd;
|
|
90406
|
+
_this.autoplay = autoplay;
|
|
90407
|
+
_this.reconnectOnReset = reconnectOnReset;
|
|
90408
|
+
_this.name = name;
|
|
90409
|
+
_this.connected = false;
|
|
90410
|
+
_this.playing = false;
|
|
90411
|
+
_this.hasPlayed = false;
|
|
90412
|
+
_this.buffer = null;
|
|
90413
|
+
_this.audioNode = null;
|
|
90414
|
+
_this.volumeNode = null;
|
|
90415
|
+
|
|
90416
|
+
_this.setupAudio();
|
|
90417
|
+
|
|
90418
|
+
_this.setName(name);
|
|
90419
|
+
|
|
90420
|
+
_this.setBody({
|
|
90421
|
+
body: new Object3D()
|
|
90422
|
+
});
|
|
90423
|
+
|
|
90424
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.DEFAULT);
|
|
90425
|
+
|
|
90426
|
+
Audio$1.add(_assertThisInitialized(_this));
|
|
90427
|
+
return _this;
|
|
90332
90428
|
}
|
|
90333
90429
|
|
|
90334
|
-
_createClass(
|
|
90335
|
-
key: "
|
|
90336
|
-
value: function
|
|
90337
|
-
this.
|
|
90430
|
+
_createClass(Sound, [{
|
|
90431
|
+
key: "setupAudio",
|
|
90432
|
+
value: function setupAudio() {
|
|
90433
|
+
this.createAudioNode();
|
|
90338
90434
|
this.createVolumeNode();
|
|
90339
90435
|
this.setBuffer();
|
|
90340
|
-
this.
|
|
90436
|
+
this.setupAudioNodeLoop();
|
|
90437
|
+
this.audioNode.removeEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
90438
|
+
this.audioNode.addEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
90439
|
+
}
|
|
90440
|
+
}, {
|
|
90441
|
+
key: "createAudioNode",
|
|
90442
|
+
value: function createAudioNode() {
|
|
90443
|
+
this.audioNode = Audio$1.context.createBufferSource();
|
|
90444
|
+
}
|
|
90445
|
+
}, {
|
|
90446
|
+
key: "setupAudioNodeLoop",
|
|
90447
|
+
value: function setupAudioNodeLoop() {
|
|
90448
|
+
this.audioNode.loop = this.loop;
|
|
90449
|
+
this.audioNode.loopEnd = this.loopEnd === undefined ? this.duration : this.loopEnd;
|
|
90450
|
+
this.audioNode.loopStart = this.loopStart === undefined ? this.duration : this.loopStart;
|
|
90341
90451
|
}
|
|
90342
90452
|
}, {
|
|
90343
90453
|
key: "createVolumeNode",
|
|
90344
90454
|
value: function createVolumeNode() {
|
|
90345
90455
|
this.volumeNode = Audio$1.context.createGain();
|
|
90346
|
-
this.volumeNode.gain.value =
|
|
90456
|
+
this.volumeNode.gain.value = DEFAULT_AUDIO_NODE_VOLUME;
|
|
90457
|
+
}
|
|
90458
|
+
}, {
|
|
90459
|
+
key: "tryAutoplay",
|
|
90460
|
+
value: function tryAutoplay() {
|
|
90461
|
+
if (this.autoplay && !this.hasPlayed) {
|
|
90462
|
+
this.play();
|
|
90463
|
+
}
|
|
90347
90464
|
}
|
|
90348
90465
|
}, {
|
|
90349
90466
|
key: "connect",
|
|
@@ -90353,33 +90470,24 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90353
90470
|
}
|
|
90354
90471
|
|
|
90355
90472
|
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
90356
|
-
this.
|
|
90473
|
+
this.audioNode.connect(this.volumeNode);
|
|
90357
90474
|
this.connected = true;
|
|
90475
|
+
this.tryAutoplay();
|
|
90358
90476
|
}
|
|
90359
90477
|
}, {
|
|
90360
90478
|
key: "disconnect",
|
|
90361
90479
|
value: function disconnect() {
|
|
90362
90480
|
if (this.connected) {
|
|
90363
90481
|
this.volumeNode.disconnect();
|
|
90364
|
-
this.
|
|
90482
|
+
this.audioNode.disconnect();
|
|
90365
90483
|
this.connected = false;
|
|
90366
90484
|
}
|
|
90367
90485
|
}
|
|
90368
|
-
}, {
|
|
90369
|
-
key: "reset",
|
|
90370
|
-
value: function reset() {
|
|
90371
|
-
this.playing = false;
|
|
90372
|
-
var reconnectOnReset = this.options.reconnectOnReset;
|
|
90373
|
-
this.disconnect();
|
|
90374
|
-
|
|
90375
|
-
if (reconnectOnReset) {
|
|
90376
|
-
this.init();
|
|
90377
|
-
this.connect();
|
|
90378
|
-
}
|
|
90379
|
-
}
|
|
90380
90486
|
}, {
|
|
90381
90487
|
key: "dispose",
|
|
90382
90488
|
value: function dispose() {
|
|
90489
|
+
_get(_getPrototypeOf(Sound.prototype), "dispose", this).call(this);
|
|
90490
|
+
|
|
90383
90491
|
this.stop();
|
|
90384
90492
|
this.disconnect();
|
|
90385
90493
|
}
|
|
@@ -90390,7 +90498,8 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90390
90498
|
}
|
|
90391
90499
|
}, {
|
|
90392
90500
|
key: "setVolume",
|
|
90393
|
-
value: function setVolume(
|
|
90501
|
+
value: function setVolume() {
|
|
90502
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_AUDIO_NODE_VOLUME;
|
|
90394
90503
|
this.volumeNode.gain.setValueAtTime(value, Audio$1.context.currentTime);
|
|
90395
90504
|
}
|
|
90396
90505
|
}, {
|
|
@@ -90401,7 +90510,7 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90401
90510
|
}, {
|
|
90402
90511
|
key: "setBuffer",
|
|
90403
90512
|
value: function setBuffer() {
|
|
90404
|
-
var buffer = Audio$1.get(this.
|
|
90513
|
+
var buffer = Audio$1.get(this.source);
|
|
90405
90514
|
|
|
90406
90515
|
if (!buffer) {
|
|
90407
90516
|
console.error(AUDIO_UNABLE_TO_LOAD_SOUND);
|
|
@@ -90409,107 +90518,60 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90409
90518
|
}
|
|
90410
90519
|
|
|
90411
90520
|
this.buffer = buffer;
|
|
90412
|
-
this.
|
|
90521
|
+
this.audioNode.buffer = buffer;
|
|
90413
90522
|
}
|
|
90414
90523
|
}, {
|
|
90415
90524
|
key: "play",
|
|
90416
90525
|
value: function play() {
|
|
90417
90526
|
var volume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getVolume();
|
|
90418
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
90527
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_AUDIO_NODE_RAMP_TIME;
|
|
90419
90528
|
var ramp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : AUDIO_RAMPS.LINEAR;
|
|
90420
|
-
if (this.playing) return;
|
|
90529
|
+
if (this.playing) return Promise.resolve();
|
|
90421
90530
|
this.setVolume(0);
|
|
90422
|
-
this.
|
|
90531
|
+
this.audioNode.start();
|
|
90532
|
+
this.hasPlayed = true;
|
|
90423
90533
|
this.playing = true;
|
|
90534
|
+
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
90424
90535
|
|
|
90425
90536
|
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
90426
|
-
this.volumeNode.gain.linearRampToValueAtTime(volume, Audio$1.context.currentTime +
|
|
90537
|
+
this.volumeNode.gain.linearRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
90427
90538
|
} else {
|
|
90428
|
-
this.volumeNode.gain.exponentialRampToValueAtTime(volume, Audio$1.context.currentTime +
|
|
90539
|
+
this.volumeNode.gain.exponentialRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
90429
90540
|
}
|
|
90541
|
+
|
|
90542
|
+
return this;
|
|
90430
90543
|
}
|
|
90431
90544
|
}, {
|
|
90432
90545
|
key: "onSoundEnded",
|
|
90433
90546
|
value: function onSoundEnded() {
|
|
90434
90547
|
this.reset();
|
|
90548
|
+
this.dispatchEvent({
|
|
90549
|
+
type: ENTITY_EVENTS.AUDIO.ENDED
|
|
90550
|
+
});
|
|
90435
90551
|
}
|
|
90436
90552
|
}, {
|
|
90437
90553
|
key: "stop",
|
|
90438
90554
|
value: function stop() {
|
|
90439
|
-
var
|
|
90440
|
-
|
|
90441
|
-
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.1;
|
|
90555
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_AUDIO_NODE_RAMP_TIME;
|
|
90442
90556
|
var ramp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AUDIO_RAMPS.LINEAR;
|
|
90557
|
+
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
90443
90558
|
|
|
90444
90559
|
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
90445
|
-
this.volumeNode.gain.linearRampToValueAtTime(
|
|
90560
|
+
this.volumeNode.gain.linearRampToValueAtTime(ALMOST_ZERO, Audio$1.context.currentTime + audioDelay);
|
|
90446
90561
|
} else {
|
|
90447
|
-
this.volumeNode.gain.exponentialRampToValueAtTime(
|
|
90562
|
+
this.volumeNode.gain.exponentialRampToValueAtTime(ALMOST_ZERO, Audio$1.context.currentTime + audioDelay);
|
|
90448
90563
|
}
|
|
90449
90564
|
|
|
90450
|
-
setTimeout(
|
|
90451
|
-
|
|
90452
|
-
}, delay);
|
|
90565
|
+
setTimeout(this.reset, delay);
|
|
90566
|
+
return this;
|
|
90453
90567
|
}
|
|
90454
90568
|
}, {
|
|
90455
90569
|
key: "detune",
|
|
90456
90570
|
value: function detune(value) {
|
|
90457
|
-
if (this.
|
|
90458
|
-
this.
|
|
90571
|
+
if (this.audioNode) {
|
|
90572
|
+
this.audioNode.detune.value = value;
|
|
90459
90573
|
}
|
|
90460
90574
|
}
|
|
90461
|
-
}]);
|
|
90462
|
-
|
|
90463
|
-
return Beat;
|
|
90464
|
-
}();var Sound$1 = /*#__PURE__*/function (_Beat) {
|
|
90465
|
-
_inherits(Sound, _Beat);
|
|
90466
|
-
|
|
90467
|
-
var _super = _createSuper(Sound);
|
|
90468
|
-
|
|
90469
|
-
function Sound(name) {
|
|
90470
|
-
var _this;
|
|
90471
|
-
|
|
90472
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
90473
|
-
|
|
90474
|
-
_classCallCheck(this, Sound);
|
|
90475
|
-
|
|
90476
|
-
var _options$loop = options.loop,
|
|
90477
|
-
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90478
|
-
_options$autoplay = options.autoplay,
|
|
90479
|
-
autoplay = _options$autoplay === void 0 ? false : _options$autoplay,
|
|
90480
|
-
_options$reconnectOnR = options.reconnectOnReset,
|
|
90481
|
-
reconnectOnReset = _options$reconnectOnR === void 0 ? false : _options$reconnectOnR;
|
|
90482
|
-
_this = _super.call(this, name, {
|
|
90483
|
-
loop: loop,
|
|
90484
|
-
autoplay: autoplay,
|
|
90485
|
-
reconnectOnReset: reconnectOnReset
|
|
90486
|
-
});
|
|
90487
|
-
_this.source.loop = loop;
|
|
90488
|
-
_this.target = null;
|
|
90489
|
-
_this.pannerNode = null;
|
|
90490
|
-
_this.convolverNode = null;
|
|
90491
|
-
|
|
90492
|
-
if (autoplay) {
|
|
90493
|
-
_this.play();
|
|
90494
|
-
}
|
|
90495
|
-
|
|
90496
|
-
Audio$1.add(_assertThisInitialized(_this));
|
|
90497
|
-
return _this;
|
|
90498
|
-
}
|
|
90499
|
-
|
|
90500
|
-
_createClass(Sound, [{
|
|
90501
|
-
key: "createPannerNode",
|
|
90502
|
-
value: function createPannerNode() {
|
|
90503
|
-
this.pannerNode = Audio$1.context.createPanner();
|
|
90504
|
-
this.volumeNode.disconnect();
|
|
90505
|
-
this.volumeNode.connect(this.pannerNode);
|
|
90506
|
-
this.pannerNode.connect(Audio$1.getMasterVolumeNode());
|
|
90507
|
-
}
|
|
90508
|
-
}, {
|
|
90509
|
-
key: "hasEffect",
|
|
90510
|
-
value: function hasEffect() {
|
|
90511
|
-
return !!this.convolverNode;
|
|
90512
|
-
}
|
|
90513
90575
|
}, {
|
|
90514
90576
|
key: "addEffect",
|
|
90515
90577
|
value: function addEffect(effect) {
|
|
@@ -90539,279 +90601,180 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90539
90601
|
}
|
|
90540
90602
|
}
|
|
90541
90603
|
}, {
|
|
90542
|
-
key: "
|
|
90543
|
-
|
|
90544
|
-
return
|
|
90545
|
-
}
|
|
90546
|
-
}, {
|
|
90547
|
-
key: "hasTarget",
|
|
90548
|
-
value: function hasTarget() {
|
|
90549
|
-
return !!this.target;
|
|
90550
|
-
}
|
|
90551
|
-
}, {
|
|
90552
|
-
key: "getTarget",
|
|
90553
|
-
value: function getTarget() {
|
|
90554
|
-
return this.target;
|
|
90604
|
+
key: "sampleRate",
|
|
90605
|
+
get: function get() {
|
|
90606
|
+
return this.buffer.sampleRate;
|
|
90555
90607
|
}
|
|
90556
90608
|
}, {
|
|
90557
|
-
key: "
|
|
90558
|
-
|
|
90559
|
-
this.
|
|
90560
|
-
this.createPannerNode();
|
|
90609
|
+
key: "duration",
|
|
90610
|
+
get: function get() {
|
|
90611
|
+
return this.buffer.duration * 1000;
|
|
90561
90612
|
}
|
|
90562
90613
|
}, {
|
|
90563
|
-
key: "
|
|
90564
|
-
|
|
90565
|
-
|
|
90566
|
-
var p = new Vector3$1();
|
|
90567
|
-
p.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90568
|
-
var px = p.x,
|
|
90569
|
-
py = p.y,
|
|
90570
|
-
pz = p.z;
|
|
90571
|
-
this.target.getBody().updateMatrixWorld();
|
|
90572
|
-
var q = new Vector3$1();
|
|
90573
|
-
q.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90574
|
-
var dx = q.x - px,
|
|
90575
|
-
dy = q.y - py,
|
|
90576
|
-
dz = q.z - pz; //setting panner position and velocity using doppler effect.
|
|
90577
|
-
|
|
90578
|
-
try {
|
|
90579
|
-
this.panner.setPosition(q.x, q.y, q.z);
|
|
90580
|
-
this.panner.setVelocity(dx / dt, dy / dt, dz / dt);
|
|
90581
|
-
} catch (e) {// quick and dirty solution.
|
|
90582
|
-
}
|
|
90583
|
-
}
|
|
90614
|
+
key: "numberOfChannels",
|
|
90615
|
+
get: function get() {
|
|
90616
|
+
return this.buffer.numberOfChannels;
|
|
90584
90617
|
}
|
|
90585
90618
|
}]);
|
|
90586
90619
|
|
|
90587
90620
|
return Sound;
|
|
90588
|
-
}(
|
|
90589
|
-
_inherits(BackgroundSound, _Sound);
|
|
90621
|
+
}(Entity);var _excluded$2 = ["name"];
|
|
90590
90622
|
|
|
90591
|
-
|
|
90623
|
+
var AmbientSound = /*#__PURE__*/function (_Sound) {
|
|
90624
|
+
_inherits(AmbientSound, _Sound);
|
|
90592
90625
|
|
|
90593
|
-
|
|
90594
|
-
_classCallCheck(this, BackgroundSound);
|
|
90626
|
+
var _super = _createSuper(AmbientSound);
|
|
90595
90627
|
|
|
90596
|
-
|
|
90597
|
-
}
|
|
90598
|
-
|
|
90599
|
-
_createClass(BackgroundSound, [{
|
|
90600
|
-
key: "update",
|
|
90601
|
-
value: function update(dt) {}
|
|
90602
|
-
}, {
|
|
90603
|
-
key: "createPannerNode",
|
|
90604
|
-
value: function createPannerNode() {
|
|
90605
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90606
|
-
}
|
|
90607
|
-
}, {
|
|
90608
|
-
key: "hasPannerNode",
|
|
90609
|
-
value: function hasPannerNode() {
|
|
90610
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90611
|
-
}
|
|
90612
|
-
}, {
|
|
90613
|
-
key: "hasTarget",
|
|
90614
|
-
value: function hasTarget() {
|
|
90615
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90616
|
-
}
|
|
90617
|
-
}, {
|
|
90618
|
-
key: "getTarget",
|
|
90619
|
-
value: function getTarget() {
|
|
90620
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90621
|
-
}
|
|
90622
|
-
}, {
|
|
90623
|
-
key: "setTarget",
|
|
90624
|
-
value: function setTarget() {
|
|
90625
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90626
|
-
}
|
|
90627
|
-
}]);
|
|
90628
|
-
|
|
90629
|
-
return BackgroundSound;
|
|
90630
|
-
}(Sound$1);var DirectionalSound = /*#__PURE__*/function (_Sound) {
|
|
90631
|
-
_inherits(DirectionalSound, _Sound);
|
|
90632
|
-
|
|
90633
|
-
var _super = _createSuper(DirectionalSound);
|
|
90634
|
-
|
|
90635
|
-
function DirectionalSound(name, angles, options) {
|
|
90628
|
+
function AmbientSound(source) {
|
|
90636
90629
|
var _this;
|
|
90637
90630
|
|
|
90638
|
-
|
|
90631
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
90632
|
+
_ref$name = _ref.name,
|
|
90633
|
+
name = _ref$name === void 0 ? generateRandomName('AmbientSound') : _ref$name,
|
|
90634
|
+
options = _objectWithoutProperties(_ref, _excluded$2);
|
|
90639
90635
|
|
|
90640
|
-
|
|
90641
|
-
|
|
90636
|
+
_classCallCheck(this, AmbientSound);
|
|
90637
|
+
|
|
90638
|
+
_this = _super.call(this, _objectSpread2$1({
|
|
90639
|
+
source: source,
|
|
90640
|
+
name: name
|
|
90641
|
+
}, options));
|
|
90642
90642
|
|
|
90643
|
-
|
|
90644
|
-
_this.setTarget(target);
|
|
90643
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.AMBIENT);
|
|
90645
90644
|
|
|
90646
|
-
|
|
90647
|
-
}
|
|
90645
|
+
_this.connect();
|
|
90648
90646
|
|
|
90649
90647
|
return _this;
|
|
90650
90648
|
}
|
|
90651
90649
|
|
|
90652
|
-
|
|
90653
|
-
|
|
90654
|
-
value: function setPannerAngles(angles) {
|
|
90655
|
-
this.pannerNode.coneInnerAngle = angles.innerAngleInDegrees;
|
|
90656
|
-
this.pannerNode.coneOuterAngle = angles.outerAngleInDegrees;
|
|
90657
|
-
this.pannerNode.coneOuterGain = angles.outerGainFactor;
|
|
90658
|
-
}
|
|
90659
|
-
}, {
|
|
90660
|
-
key: "setPannerOrientation",
|
|
90661
|
-
value: function setPannerOrientation() {
|
|
90662
|
-
if (this.hasPannerNode()) {
|
|
90663
|
-
var vec = new Vector3$1(0, 0, 1);
|
|
90664
|
-
var m = this.target.getBody().matrixWorld; // Save the translation column and zero it.
|
|
90665
|
-
|
|
90666
|
-
var mx = m.elements[12],
|
|
90667
|
-
my = m.elements[13],
|
|
90668
|
-
mz = m.elements[14];
|
|
90669
|
-
m.elements[12] = m.elements[13] = m.elements[14] = 0; // Multiply the 0,0,1 vector by the world matrix and normalize the result.
|
|
90670
|
-
|
|
90671
|
-
vec.applyProjection(m);
|
|
90672
|
-
vec.normalize();
|
|
90673
|
-
this.pannerNode.setOrientation(vec.x, vec.y, vec.z); // Restore the translation column.
|
|
90650
|
+
return AmbientSound;
|
|
90651
|
+
}(Sound);var _excluded$1 = ["name"];
|
|
90674
90652
|
|
|
90675
|
-
|
|
90676
|
-
|
|
90677
|
-
m.elements[14] = mz;
|
|
90678
|
-
}
|
|
90679
|
-
}
|
|
90680
|
-
}, {
|
|
90681
|
-
key: "update",
|
|
90682
|
-
value: function update(dt) {
|
|
90683
|
-
_get(_getPrototypeOf(DirectionalSound.prototype), "update", this).call(this, dt);
|
|
90653
|
+
var DirectionalSound = /*#__PURE__*/function (_Sound) {
|
|
90654
|
+
_inherits(DirectionalSound, _Sound);
|
|
90684
90655
|
|
|
90685
|
-
|
|
90686
|
-
}
|
|
90687
|
-
}]);
|
|
90656
|
+
var _super = _createSuper(DirectionalSound);
|
|
90688
90657
|
|
|
90689
|
-
|
|
90690
|
-
|
|
90691
|
-
_inherits(Sound, _Beat);
|
|
90658
|
+
function DirectionalSound(source) {
|
|
90659
|
+
var _this;
|
|
90692
90660
|
|
|
90693
|
-
|
|
90661
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
90662
|
+
_ref$name = _ref.name,
|
|
90663
|
+
name = _ref$name === void 0 ? generateRandomName('DirectionalSound') : _ref$name,
|
|
90664
|
+
options = _objectWithoutProperties(_ref, _excluded$1);
|
|
90694
90665
|
|
|
90695
|
-
|
|
90696
|
-
var _this;
|
|
90666
|
+
_classCallCheck(this, DirectionalSound);
|
|
90697
90667
|
|
|
90698
|
-
|
|
90668
|
+
_this = _super.call(this, _objectSpread2$1({
|
|
90669
|
+
source: source,
|
|
90670
|
+
name: name
|
|
90671
|
+
}, options));
|
|
90699
90672
|
|
|
90700
|
-
|
|
90673
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.DIRECTIONAL);
|
|
90701
90674
|
|
|
90702
|
-
|
|
90703
|
-
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90704
|
-
_options$autoplay = options.autoplay,
|
|
90705
|
-
autoplay = _options$autoplay === void 0 ? false : _options$autoplay,
|
|
90706
|
-
_options$reconnectOnR = options.reconnectOnReset,
|
|
90707
|
-
reconnectOnReset = _options$reconnectOnR === void 0 ? false : _options$reconnectOnR;
|
|
90708
|
-
_this = _super.call(this, name, {
|
|
90709
|
-
loop: loop,
|
|
90710
|
-
autoplay: autoplay,
|
|
90711
|
-
reconnectOnReset: reconnectOnReset
|
|
90712
|
-
});
|
|
90713
|
-
_this.source.loop = loop;
|
|
90714
|
-
_this.target = null;
|
|
90715
|
-
_this.pannerNode = null;
|
|
90716
|
-
_this.convolverNode = null;
|
|
90675
|
+
_this.createPannerNode(options);
|
|
90717
90676
|
|
|
90718
|
-
|
|
90719
|
-
_this.play();
|
|
90720
|
-
}
|
|
90677
|
+
_this.connect();
|
|
90721
90678
|
|
|
90722
|
-
Audio$1.add(_assertThisInitialized(_this));
|
|
90723
90679
|
return _this;
|
|
90724
90680
|
}
|
|
90725
90681
|
|
|
90726
|
-
_createClass(
|
|
90682
|
+
_createClass(DirectionalSound, [{
|
|
90683
|
+
key: "hasPannerNode",
|
|
90684
|
+
value: function hasPannerNode() {
|
|
90685
|
+
return !!this.pannerNode;
|
|
90686
|
+
}
|
|
90687
|
+
}, {
|
|
90727
90688
|
key: "createPannerNode",
|
|
90728
90689
|
value: function createPannerNode() {
|
|
90690
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90691
|
+
var _options$coneInnerAng = options.coneInnerAngleDegrees,
|
|
90692
|
+
coneInnerAngleDegrees = _options$coneInnerAng === void 0 ? 360 : _options$coneInnerAng,
|
|
90693
|
+
_options$coneOuterAng = options.coneOuterAngleDegrees,
|
|
90694
|
+
coneOuterAngleDegrees = _options$coneOuterAng === void 0 ? 0 : _options$coneOuterAng,
|
|
90695
|
+
_options$coneOuterGai = options.coneOuterGain,
|
|
90696
|
+
coneOuterGain = _options$coneOuterGai === void 0 ? 0 : _options$coneOuterGai,
|
|
90697
|
+
_options$maxDistance = options.maxDistance,
|
|
90698
|
+
maxDistance = _options$maxDistance === void 0 ? 10000 : _options$maxDistance,
|
|
90699
|
+
_options$rolloffFacto = options.rolloffFactor,
|
|
90700
|
+
rolloffFactor = _options$rolloffFacto === void 0 ? 1 : _options$rolloffFacto,
|
|
90701
|
+
_options$refDistance = options.refDistance,
|
|
90702
|
+
refDistance = _options$refDistance === void 0 ? 1 : _options$refDistance;
|
|
90729
90703
|
this.pannerNode = Audio$1.context.createPanner();
|
|
90730
|
-
this.
|
|
90731
|
-
this.
|
|
90732
|
-
this.pannerNode.
|
|
90704
|
+
this.pannerNode.panningModel = 'HRTF';
|
|
90705
|
+
this.pannerNode.distanceModel = 'inverse';
|
|
90706
|
+
this.pannerNode.refDistance = refDistance;
|
|
90707
|
+
this.pannerNode.maxDistance = maxDistance;
|
|
90708
|
+
this.pannerNode.rolloffFactor = rolloffFactor;
|
|
90709
|
+
this.pannerNode.coneInnerAngle = coneInnerAngleDegrees;
|
|
90710
|
+
this.pannerNode.coneOuterAngle = coneOuterAngleDegrees;
|
|
90711
|
+
this.pannerNode.coneOuterGain = coneOuterGain;
|
|
90733
90712
|
}
|
|
90734
90713
|
}, {
|
|
90735
|
-
key: "
|
|
90736
|
-
value: function
|
|
90737
|
-
|
|
90738
|
-
|
|
90739
|
-
}, {
|
|
90740
|
-
key: "addEffect",
|
|
90741
|
-
value: function addEffect(effect) {
|
|
90742
|
-
if (!this.hasEffect() && effect) {
|
|
90743
|
-
this.convolverNode = Audio$1.context.createConvolver();
|
|
90744
|
-
this.mixerNode = Audio$1.createGain();
|
|
90745
|
-
|
|
90746
|
-
if (this.hasPannerNode()) {
|
|
90747
|
-
this.pannerNode.disconnect();
|
|
90748
|
-
this.pannerNode.connect(this.mixerNode);
|
|
90749
|
-
} else {
|
|
90750
|
-
this.volumeNode.disconnect();
|
|
90751
|
-
this.volumeNode.connect(this.mixerNode);
|
|
90752
|
-
} //creating gains
|
|
90753
|
-
|
|
90754
|
-
|
|
90755
|
-
this.plainGainNode = Audio$1.context.createGain();
|
|
90756
|
-
this.convolverGainNode = Audio$1.context.createGain(); //connect mixer to new gains
|
|
90757
|
-
|
|
90758
|
-
this.mixerNode.connect(this.plainGainNode);
|
|
90759
|
-
this.mixerNode.connect(this.convolverGainNode);
|
|
90760
|
-
this.plainGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
90761
|
-
this.convolverGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
90762
|
-
this.convolverNode.buffer = Audio$1.get(effect);
|
|
90763
|
-
this.convolverGainNode.gain.setValueAtTime(0.7, Audio$1.context.currentTime);
|
|
90764
|
-
this.plainGainNode.gain.setValueAtTime(0.3, Audio$1.context.currentTime);
|
|
90714
|
+
key: "connect",
|
|
90715
|
+
value: function connect() {
|
|
90716
|
+
if (this.connected) {
|
|
90717
|
+
this.disconnect();
|
|
90765
90718
|
}
|
|
90719
|
+
|
|
90720
|
+
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
90721
|
+
this.pannerNode.connect(this.volumeNode);
|
|
90722
|
+
this.audioNode.connect(this.pannerNode);
|
|
90723
|
+
this.connected = true;
|
|
90724
|
+
this.tryAutoplay();
|
|
90766
90725
|
}
|
|
90767
90726
|
}, {
|
|
90768
|
-
key: "
|
|
90769
|
-
value: function
|
|
90770
|
-
|
|
90771
|
-
|
|
90772
|
-
|
|
90773
|
-
|
|
90774
|
-
|
|
90775
|
-
|
|
90727
|
+
key: "disconnect",
|
|
90728
|
+
value: function disconnect() {
|
|
90729
|
+
if (this.connected) {
|
|
90730
|
+
this.volumeNode.disconnect();
|
|
90731
|
+
this.pannerNode.disconnect();
|
|
90732
|
+
this.audioNode.disconnect();
|
|
90733
|
+
this.connected = false;
|
|
90734
|
+
}
|
|
90776
90735
|
}
|
|
90777
90736
|
}, {
|
|
90778
|
-
key: "
|
|
90779
|
-
value: function
|
|
90780
|
-
|
|
90737
|
+
key: "updatePannerOrientation",
|
|
90738
|
+
value: function updatePannerOrientation() {
|
|
90739
|
+
var vec = new Vector3$1(0, 0, 1);
|
|
90740
|
+
var m = this.getBody().matrixWorld;
|
|
90741
|
+
var mx = m.elements[12],
|
|
90742
|
+
my = m.elements[13],
|
|
90743
|
+
mz = m.elements[14];
|
|
90744
|
+
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
90745
|
+
vec.applyMatrix4(m);
|
|
90746
|
+
vec.normalize();
|
|
90747
|
+
this.pannerNode.orientationX.setValueAtTime(vec.x, Audio$1.context.currentTime);
|
|
90748
|
+
this.pannerNode.orientationY.setValueAtTime(vec.y, Audio$1.context.currentTime);
|
|
90749
|
+
this.pannerNode.orientationZ.setValueAtTime(vec.z, Audio$1.context.currentTime);
|
|
90750
|
+
m.elements[12] = mx;
|
|
90751
|
+
m.elements[13] = my;
|
|
90752
|
+
m.elements[14] = mz;
|
|
90781
90753
|
}
|
|
90782
90754
|
}, {
|
|
90783
|
-
key: "
|
|
90784
|
-
value: function
|
|
90785
|
-
this.
|
|
90786
|
-
|
|
90755
|
+
key: "updatePannerPosition",
|
|
90756
|
+
value: function updatePannerPosition() {
|
|
90757
|
+
this.getBody().updateMatrixWorld();
|
|
90758
|
+
var position = new Vector3$1();
|
|
90759
|
+
position.setFromMatrixPosition(this.getBody().matrixWorld);
|
|
90760
|
+
this.pannerNode.positionX.setValueAtTime(position.x, Audio$1.context.currentTime);
|
|
90761
|
+
this.pannerNode.positionY.setValueAtTime(position.y, Audio$1.context.currentTime);
|
|
90762
|
+
this.pannerNode.positionZ.setValueAtTime(position.z, Audio$1.context.currentTime);
|
|
90787
90763
|
}
|
|
90788
90764
|
}, {
|
|
90789
90765
|
key: "update",
|
|
90790
90766
|
value: function update(dt) {
|
|
90791
|
-
|
|
90792
|
-
var p = new Vector3$1();
|
|
90793
|
-
p.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90794
|
-
var px = p.x,
|
|
90795
|
-
py = p.y,
|
|
90796
|
-
pz = p.z;
|
|
90797
|
-
this.target.getBody().updateMatrixWorld();
|
|
90798
|
-
var q = new Vector3$1();
|
|
90799
|
-
q.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90800
|
-
var dx = q.x - px,
|
|
90801
|
-
dy = q.y - py,
|
|
90802
|
-
dz = q.z - pz; //setting panner position and velocity using doppler effect.
|
|
90767
|
+
_get(_getPrototypeOf(DirectionalSound.prototype), "update", this).call(this, dt);
|
|
90803
90768
|
|
|
90804
|
-
|
|
90805
|
-
|
|
90806
|
-
|
|
90807
|
-
} catch (e) {// quick and dirty solution.
|
|
90808
|
-
}
|
|
90769
|
+
if (this.hasPannerNode()) {
|
|
90770
|
+
this.updatePannerOrientation();
|
|
90771
|
+
this.updatePannerPosition();
|
|
90809
90772
|
}
|
|
90810
90773
|
}
|
|
90811
90774
|
}]);
|
|
90812
90775
|
|
|
90813
|
-
return
|
|
90814
|
-
}(
|
|
90776
|
+
return DirectionalSound;
|
|
90777
|
+
}(Sound);var BLOB_TYPE = 'application/javascript';
|
|
90815
90778
|
var createBlob = function createBlob(task) {
|
|
90816
90779
|
return new Blob(['(', task.toString(), ')()'], {
|
|
90817
90780
|
type: BLOB_TYPE
|
|
@@ -92780,4 +92743,4 @@ var Shaders$1 = new Shaders();var Shader = function Shader(name, attributes, uni
|
|
|
92780
92743
|
} else {
|
|
92781
92744
|
this.instance = this.shader.instance;
|
|
92782
92745
|
}
|
|
92783
|
-
};var constants = _objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants);export{AUDIO_RAMPS,AmbientLight,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,
|
|
92746
|
+
};var constants = _objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants);export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,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,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,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};
|