mage-engine 3.17.2 → 3.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mage.js +443 -319
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -53576,7 +53576,6 @@ var EFFECT_COULD_NOT_BE_CREATED = "".concat(PREFIX, " Could not create requeste
53576
53576
  var EFFECT_UNAVAILABLE = "".concat(PREFIX, " Requested effect is not available.");
53577
53577
  var SCRIPT_NOT_FOUND = "".concat(PREFIX, " Could not find desired script.");
53578
53578
  var KEYBOARD_COMBO_ALREADY_REGISTERED = "".concat(PREFIX, " Keyboard combo already registered.");
53579
- var KEYBOARD_COMBO_IS_INVALID = "".concat(PREFIX, " Keyboard combo is not valid.");
53580
53579
  var PHYSICS_ELEMENT_CANT_BE_REMOVED = "".concat(PREFIX, " This element can't be removed from physics world.");
53581
53580
  var PHYSICS_ELEMENT_ALREADY_STORED = "".concat(PREFIX, " This element has already been added to the world.");
53582
53581
  var ASSETS_AUDIO_LOAD_FAIL = "".concat(PREFIX, " Could not load audio.");
@@ -54175,30 +54174,46 @@ if (typeof window !== 'undefined') {
54175
54174
  keyup: true,
54176
54175
  keydown: true
54177
54176
  };
54178
- var COMBINATION_DIVIDER = '+';
54177
+ var KEY_PRESS = 'keyPress';
54178
+ var KEY_DOWN = 'keyDown';
54179
+ var KEY_UP = 'keyUp';
54180
+
54181
+ var Keyboard = /*#__PURE__*/function (_EventDispatcher) {
54182
+ _inherits(Keyboard, _EventDispatcher);
54183
+
54184
+ var _super = _createSuper(Keyboard);
54179
54185
 
54180
- var Keyboard = /*#__PURE__*/function () {
54181
54186
  function Keyboard() {
54182
- var _this = this;
54187
+ var _this;
54183
54188
 
54184
54189
  _classCallCheck(this, Keyboard);
54185
54190
 
54186
- _defineProperty$1(this, "handler", function (event, handler) {
54187
- if (!_this.enabled) return;
54191
+ _this = _super.call(this);
54188
54192
 
54189
- _this.listener(event, handler); // this stops propagation and deafult OS handling for events like cmd + s, cmd + r
54193
+ _defineProperty$1(_assertThisInitialized(_this), "handleKeydown", function (event) {
54194
+ _this.dispatchEvent({
54195
+ type: KEY_DOWN,
54196
+ event: event
54197
+ });
54198
+ });
54190
54199
 
54200
+ _defineProperty$1(_assertThisInitialized(_this), "handleKeyup", function (event) {
54201
+ _this.dispatchEvent({
54202
+ type: KEY_UP,
54203
+ event: event
54204
+ });
54205
+ });
54191
54206
 
54192
- return false;
54207
+ _defineProperty$1(_assertThisInitialized(_this), "handleKeypress", function (event) {
54208
+ _this.dispatchEvent({
54209
+ type: KEY_PRESS,
54210
+ event: event
54211
+ });
54193
54212
  });
54194
54213
 
54195
- this.keys = ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'l', 'k', 'j', 'h', 'g', 'f', 'd', 's', 'a', 'z', 'x', 'c', 'v', 'b', 'n', 'm'];
54196
- this.specials = ['esc', 'escape', 'enter', 'space'];
54197
- this.symbols = [];
54198
- this.numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
54199
- this.combos = [].concat(_toConsumableArray(this.keys), _toConsumableArray(this.numbers), _toConsumableArray(this.specials), _toConsumableArray(this.symbols));
54200
- this.enabled = false;
54201
- this.listener = undefined;
54214
+ _this.combos = [];
54215
+ _this.enabled = false;
54216
+ return _this;
54202
54217
  }
54203
54218
 
54204
54219
  _createClass(Keyboard, [{
@@ -54211,63 +54226,34 @@ var Keyboard = /*#__PURE__*/function () {
54211
54226
  }
54212
54227
 
54213
54228
  this.combos.push(combo);
54214
- hotkeys(combo, DEFAULT_OPTIONS, handler || this.handler);
54215
- }
54216
- }
54217
- }, {
54218
- key: "registerCombination",
54219
- value: function registerCombination() {
54220
- var combo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
54221
- var handler = arguments.length > 1 ? arguments[1] : undefined;
54222
-
54223
- if (combo instanceof Array && combo.length > 1) {
54224
- this.register(combo.join(COMBINATION_DIVIDER), handler);
54225
- } else {
54226
- console.warn(KEYBOARD_COMBO_IS_INVALID, combo);
54229
+ hotkeys(combo, DEFAULT_OPTIONS, handler);
54227
54230
  }
54228
54231
  }
54229
54232
  }, {
54230
54233
  key: "enable",
54231
54234
  value: function enable() {
54232
- var _this2 = this;
54233
-
54234
- var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (f) {
54235
- return f;
54236
- };
54237
54235
  this.enabled = true;
54238
- this.listener = cb;
54239
- this.combos.forEach(function (combo) {
54240
- hotkeys(combo, DEFAULT_OPTIONS, _this2.handler);
54241
- });
54236
+ window.addEventListener(KEY_DOWN, this.handleKeydown.bind(this));
54237
+ window.addEventListener(KEY_UP, this.handleKeyup.bind(this));
54238
+ window.addEventListener(KEY_PRESS, this.handleKeypress.bind(this));
54242
54239
  }
54243
54240
  }, {
54244
54241
  key: "disable",
54245
54242
  value: function disable() {
54246
54243
  this.enabled = false;
54247
- this.listener = undefined;
54248
- this.combos.forEach(function (combo) {
54249
- hotkeys.unbind(combo);
54250
- });
54244
+ window.removeEventListener(KEY_DOWN, this.handleKeydown.bind(this));
54245
+ window.removeEventListener(KEY_UP, this.handleKeyup.bind(this));
54246
+ window.removeEventListener(KEY_PRESS, this.handleKeypress.bind(this));
54251
54247
  }
54252
54248
  }, {
54253
54249
  key: "isPressed",
54254
54250
  value: function isPressed(key) {
54255
54251
  return hotkeys.isPressed(key);
54256
54252
  }
54257
- }], [{
54258
- key: "KEYDOWN",
54259
- get: function get() {
54260
- return 'keydown';
54261
- }
54262
- }, {
54263
- key: "KEYUP",
54264
- get: function get() {
54265
- return 'keyup';
54266
- }
54267
54253
  }]);
54268
54254
 
54269
54255
  return Keyboard;
54270
- }();var SHADOW_TYPES = {
54256
+ }(EventDispatcher);var SHADOW_TYPES = {
54271
54257
  BASIC: 'BASIC',
54272
54258
  SOFT: 'SOFT',
54273
54259
  HARD: 'HARD'
@@ -54320,13 +54306,15 @@ var Config = /*#__PURE__*/function () {
54320
54306
  function Config() {
54321
54307
  _classCallCheck(this, Config);
54322
54308
 
54323
- getWindow();
54324
54309
  this.default = {
54325
54310
  tests: [],
54326
54311
  screen: {
54327
54312
  frameRate: 60,
54328
54313
  alpha: true
54329
54314
  },
54315
+ postprocessing: {
54316
+ enabled: false
54317
+ },
54330
54318
  fog: {
54331
54319
  enabled: false,
54332
54320
  density: 0,
@@ -54427,8 +54415,8 @@ var Config = /*#__PURE__*/function () {
54427
54415
  };
54428
54416
  }
54429
54417
  }, {
54430
- key: "getDefaults",
54431
- value: function getDefaults() {
54418
+ key: "getScreenDefaults",
54419
+ value: function getScreenDefaults() {
54432
54420
  return {
54433
54421
  h: DEFAULT_HEIGHT$1,
54434
54422
  w: DEFAULT_WIDTH,
@@ -54438,7 +54426,7 @@ var Config = /*#__PURE__*/function () {
54438
54426
  }, {
54439
54427
  key: "screen",
54440
54428
  value: function screen() {
54441
- var _ref = this.getContainerSize() || this.getWindowSize() || this.getDefaults(),
54429
+ var _ref = this.getContainerSize() || this.getWindowSize() || this.getScreenDefaults(),
54442
54430
  h = _ref.h,
54443
54431
  w = _ref.w,
54444
54432
  ratio = _ref.ratio;
@@ -54451,6 +54439,11 @@ var Config = /*#__PURE__*/function () {
54451
54439
  });
54452
54440
  return this.config.screen;
54453
54441
  }
54442
+ }, {
54443
+ key: "postprocessing",
54444
+ value: function postprocessing() {
54445
+ return this.config.postprocessing;
54446
+ }
54454
54447
  }, {
54455
54448
  key: "ui",
54456
54449
  value: function ui() {
@@ -55693,7 +55686,48 @@ var Physics = /*#__PURE__*/function (_EventDispatcher) {
55693
55686
 
55694
55687
  return Physics;
55695
55688
  }(EventDispatcher);
55696
- var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55689
+ var Physics$1 = new Physics();var ENTITY_TYPES = {
55690
+ SCENE: 'SCENE',
55691
+ CAMERA: 'CAMERA',
55692
+ MESH: 'MESH',
55693
+ LIGHT: {
55694
+ DEFAULT: 'LIGHT.DEFAULT',
55695
+ AMBIENT: 'LIGHT.AMBIENT',
55696
+ SUN: 'LIGHT.SUN',
55697
+ HEMISPHERE: 'LIGHT.HEMISPHERE',
55698
+ POINT: 'LIGHT.POINT',
55699
+ SPOT: 'LIGHT.SPOT'
55700
+ },
55701
+ AUDIO: {
55702
+ DEFAULT: 'AUDIO.DEFAULT',
55703
+ AMBIENT: 'AUDIO.AMBIENT',
55704
+ DIRECTIONAL: 'AUDIO.DIRECTIONAL',
55705
+ BACKGROUND: 'AUDIO.BACKGROUND'
55706
+ },
55707
+ MODEL: 'MODEL',
55708
+ SPRITE: 'SPRITE',
55709
+ PARTICLE: 'PARTICLE',
55710
+ EFFECT: {
55711
+ PARTICLE: 'EFFECT.PARTICLE',
55712
+ SCENERY: 'EFFECT.SCENERY'
55713
+ },
55714
+ HELPER: {
55715
+ GRID: 'HELPER.GRID'
55716
+ },
55717
+ UNKNOWN: 'UNKNOWN'
55718
+ };
55719
+ var FLAT_ENTITY_TYPES = ['SCENE', 'CAMERA', 'MESH', 'LIGHT.DEFAULT', 'LIGHT.AMBIENT', 'LIGHT.SUN', 'LIGHT.HEMISPHERE', 'LIGHT.POINT', 'LIGHT.SPOT', 'AUDIO.DEFAULT', 'AUDIO.AMBIENT', 'AUDIO.DIRECTIONAL', 'AUDIO.BACKGROUND', 'MODEL', 'SPRITE', 'PARTICLE', 'EFFECT.PARTICLE', 'EFFECT.SCENERY', 'HELPER.GRID', 'UNKNOWN'];
55720
+ var ENTITY_EVENTS = {
55721
+ DISPOSE: 'DISPOSE',
55722
+ STATE_MACHINE: {
55723
+ CHANGE: 'STATE_MACHINE_CHANGE'
55724
+ },
55725
+ ANIMATION: {
55726
+ LOOP: 'LOOP',
55727
+ FINISHED: 'FINISHED'
55728
+ }
55729
+ };
55730
+ var DEFAULT_TAG = 'all';var Scene = /*#__PURE__*/function () {
55697
55731
  function Scene() {
55698
55732
  var _this = this;
55699
55733
 
@@ -55737,16 +55771,6 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55737
55771
  _this.resize(w, h);
55738
55772
  });
55739
55773
 
55740
- _defineProperty$1(this, "render", function () {
55741
- _this.renderer.setClearColor(_this.clearColor, _this.alpha);
55742
-
55743
- _this.renderer.clear();
55744
-
55745
- _this.renderer.setRenderTarget(null);
55746
-
55747
- _this.renderer.render(_this.scene, _this.camera.getBody());
55748
- });
55749
-
55750
55774
  _defineProperty$1(this, "onPhysicsUpdate", function (_ref) {
55751
55775
  var dt = _ref.dt;
55752
55776
  Universe$1.onPhysicsUpdate(dt);
@@ -55756,14 +55780,21 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55756
55780
 
55757
55781
  this.clock = new Clock();
55758
55782
  this.rendererElements = {};
55783
+ this.elements = [];
55759
55784
  this.clearColor = 0x000000;
55760
55785
  this.alpha = 1.0;
55761
55786
  this.shadowType = mapShadowTypeToShadowMap(DEFAULT_SHADOWTYPE);
55762
55787
  }
55763
55788
 
55764
55789
  _createClass(Scene, [{
55790
+ key: "getEntityType",
55791
+ value: function getEntityType() {
55792
+ return ENTITY_TYPES.SCENE;
55793
+ }
55794
+ }, {
55765
55795
  key: "createScene",
55766
- value: function createScene(name) {
55796
+ value: function createScene() {
55797
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "LevelScene_".concat(Math.random());
55767
55798
  var fog = Config$1.fog();
55768
55799
  this.scene = new Scene$2();
55769
55800
  this.scene.name = name; // this.scene.overrideMaterial = null; // should be null by default, but it's not.
@@ -55772,6 +55803,16 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55772
55803
  this.fog(fog.color, fog.density);
55773
55804
  }
55774
55805
  }
55806
+ }, {
55807
+ key: "uuid",
55808
+ value: function uuid() {
55809
+ return this.scene.uuid;
55810
+ }
55811
+ }, {
55812
+ key: "getName",
55813
+ value: function getName() {
55814
+ return this.scene.name;
55815
+ }
55775
55816
  }, {
55776
55817
  key: "getScene",
55777
55818
  value: function getScene() {
@@ -55797,11 +55838,28 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55797
55838
  var addUniverse = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
55798
55839
  this.scene.add(body);
55799
55840
 
55841
+ if (element) {
55842
+ this.elements.push(element);
55843
+ }
55844
+
55800
55845
  if (addUniverse) {
55801
- Universe$1.set(element.getName(), element);
55802
- Universe$1.storeUUIDToElementNameReference(body.uuid, element.getName());
55846
+ var name = element.getName();
55847
+ Universe$1.set(name, element);
55848
+ Universe$1.storeUUIDToElementNameReference(body.uuid, name);
55803
55849
  }
55804
55850
  }
55851
+ }, {
55852
+ key: "getHierarchy",
55853
+ value: function getHierarchy() {
55854
+ return [{
55855
+ element: this,
55856
+ children: [this.getCamera().getHierarchy()].concat(_toConsumableArray(this.elements.filter(function (e) {
55857
+ return !e.hasParent() && !e.isHelper();
55858
+ }).map(function (e) {
55859
+ return e.getHierarchy();
55860
+ })))
55861
+ }];
55862
+ }
55805
55863
  }, {
55806
55864
  key: "remove",
55807
55865
  value: function remove(body) {
@@ -55943,7 +56001,8 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55943
56001
  var container = Config$1.container();
55944
56002
  this.renderer = new WebGLRenderer({
55945
56003
  alpha: alpha,
55946
- antialias: antialias
56004
+ antialias: antialias,
56005
+ powerPreference: 'high-performance'
55947
56006
  });
55948
56007
 
55949
56008
  if (shadows) {
@@ -55979,6 +56038,14 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
55979
56038
  this.camera.getBody().updateProjectionMatrix();
55980
56039
  this.renderer.setSize(width, height);
55981
56040
  }
56041
+ }, {
56042
+ key: "render",
56043
+ value: function render() {
56044
+ this.renderer.setClearColor(this.clearColor, this.alpha);
56045
+ this.renderer.clear();
56046
+ this.renderer.setRenderTarget(null);
56047
+ this.renderer.render(this.scene, this.camera.getBody());
56048
+ }
55982
56049
  }, {
55983
56050
  key: "setFog",
55984
56051
  value: function setFog(color, density) {
@@ -56208,11 +56275,9 @@ var Features = /*#__PURE__*/function () {
56208
56275
  value: function setUpPolyfills() {
56209
56276
  var frameRate = Config$1.screen().frameRate;
56210
56277
 
56211
- window.requestNextFrame = function () {
56212
- return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback, element) {
56213
- window.setTimeout(callback, 1000 / frameRate);
56214
- };
56215
- }();
56278
+ window.requestNextFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback, element) {
56279
+ window.setTimeout(callback, 1000 / frameRate);
56280
+ };
56216
56281
  }
56217
56282
  }, {
56218
56283
  key: "isFeatureSupported",
@@ -57128,7 +57193,7 @@ function applyMiddleware() {
57128
57193
 
57129
57194
  var thunk = createThunkMiddleware();
57130
57195
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
57131
- var version = "3.17.2";
57196
+ var version = "3.17.5";
57132
57197
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
57133
57198
  var main = "dist/mage.js";
57134
57199
  var author$1 = {
@@ -57742,10 +57807,6 @@ var Gamepad = /*#__PURE__*/function (_EventDispatcher) {
57742
57807
 
57743
57808
  return Gamepad;
57744
57809
  }(EventDispatcher);var _INPUT_EVENTS;
57745
- var KEY_PRESS = 'keyPress';
57746
- var KEY_DOWN = 'keyDown';
57747
- var KEY_UP = 'keyUp';
57748
- var INPUT_EVENTS_LIST = [KEY_PRESS, KEY_DOWN, KEY_UP, MOUSE_DOWN, MOUSE_UP, MOUSE_DOWN, ELEMENT_CLICK, ELEMENT_DESELECT, GAMEPAD_CONNECTED_EVENT, GAMEPAD_DISCONNECTED_EVENT, BUTTON_PRESSED_EVENT, BUTTON_RELEASED_EVENT, AXIS_CHANGE_EVENT];
57749
57810
  var INPUT_EVENTS = (_INPUT_EVENTS = {
57750
57811
  KEY_PRESS: KEY_PRESS,
57751
57812
  KEY_DOWN: KEY_DOWN,
@@ -57769,27 +57830,6 @@ var Input = /*#__PURE__*/function (_EventDispatcher) {
57769
57830
  _this.dispatchEvent(event);
57770
57831
  });
57771
57832
 
57772
- _defineProperty$1(_assertThisInitialized(_this), "handleKeyBoardEvent", function (event, handler) {
57773
- if (event.type === Keyboard.KEYDOWN) {
57774
- _this.dispatchEvent({
57775
- type: KEY_DOWN,
57776
- event: _objectSpread2$1(_objectSpread2$1({}, event), handler)
57777
- });
57778
- }
57779
-
57780
- if (event.type === Keyboard.KEYUP) {
57781
- _this.dispatchEvent({
57782
- type: KEY_UP,
57783
- event: _objectSpread2$1(_objectSpread2$1({}, event), handler)
57784
- });
57785
- }
57786
-
57787
- _this.dispatchEvent({
57788
- type: KEY_PRESS,
57789
- event: _objectSpread2$1(_objectSpread2$1({}, event), handler)
57790
- });
57791
- });
57792
-
57793
57833
  _this.enabled = false;
57794
57834
  return _this;
57795
57835
  }
@@ -57840,7 +57880,9 @@ var Input = /*#__PURE__*/function (_EventDispatcher) {
57840
57880
  key: "enableKeyboard",
57841
57881
  value: function enableKeyboard() {
57842
57882
  dispatch(keyboardEnabled());
57843
- this.keyboard.enable(this.handleKeyBoardEvent.bind(this));
57883
+ this.keyboard.enable();
57884
+ this.keyboard.addEventListener(KEY_DOWN, this.propagate.bind(this));
57885
+ this.keyboard.addEventListener(KEY_UP, this.propagate.bind(this));
57844
57886
  }
57845
57887
  }, {
57846
57888
  key: "enableMouse",
@@ -57858,6 +57900,8 @@ var Input = /*#__PURE__*/function (_EventDispatcher) {
57858
57900
  value: function disableKeyboard() {
57859
57901
  dispatch(keyboardDisabled());
57860
57902
  this.keyboard.disable();
57903
+ this.keyboard.removeEventListener(KEY_DOWN, this.propagate.bind(this));
57904
+ this.keyboard.removeEventListener(KEY_UP, this.propagate.bind(this));
57861
57905
  this.keyboard = undefined;
57862
57906
  }
57863
57907
  }, {
@@ -58665,25 +58709,7 @@ var Scripts = /*#__PURE__*/function () {
58665
58709
 
58666
58710
  return Scripts;
58667
58711
  }();
58668
- var Scripts$1 = new Scripts();var ENTITY_TYPES = {
58669
- MESH: 'MESH',
58670
- LIGHT: 'LIGHT',
58671
- MODEL: 'MODEL',
58672
- SPRITE: 'SPRITE',
58673
- PARTICLE: 'PARTICLE',
58674
- UNKNOWN: 'UNKNOWN'
58675
- };
58676
- var ENTITY_EVENTS = {
58677
- DISPOSE: 'DISPOSE',
58678
- STATE_MACHINE: {
58679
- CHANGE: 'STATE_MACHINE_CHANGE'
58680
- },
58681
- ANIMATION: {
58682
- LOOP: 'LOOP',
58683
- FINISHED: 'FINISHED'
58684
- }
58685
- };
58686
- var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
58712
+ var Scripts$1 = new Scripts();var Entity = /*#__PURE__*/function (_EventDispatcher) {
58687
58713
  _inherits(Entity, _EventDispatcher);
58688
58714
 
58689
58715
  var _super = _createSuper(Entity);
@@ -58738,10 +58764,6 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
58738
58764
  return _this.getEntityType() === ENTITY_TYPES.MESH;
58739
58765
  });
58740
58766
 
58741
- _defineProperty$1(_assertThisInitialized(_this), "isLight", function () {
58742
- return _this.getEntityType() === ENTITY_TYPES.LIGHT;
58743
- });
58744
-
58745
58767
  _defineProperty$1(_assertThisInitialized(_this), "isModel", function () {
58746
58768
  return _this.getEntityType() === ENTITY_TYPES.MODEL;
58747
58769
  });
@@ -58750,6 +58772,18 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
58750
58772
  return _this.getEntityType() === ENTITY_TYPES.SPRITE;
58751
58773
  });
58752
58774
 
58775
+ _defineProperty$1(_assertThisInitialized(_this), "isLight", function () {
58776
+ return Object.values(ENTITY_TYPES.LIGHT).includes(_this.getEntityType());
58777
+ });
58778
+
58779
+ _defineProperty$1(_assertThisInitialized(_this), "isHelper", function () {
58780
+ return Object.values(ENTITY_TYPES.HELPER).includes(_this.getEntityType());
58781
+ });
58782
+
58783
+ _defineProperty$1(_assertThisInitialized(_this), "isEffect", function () {
58784
+ return Object.values(ENTITY_TYPES.EFFECT).includes(_this.getEntityType());
58785
+ });
58786
+
58753
58787
  _defineProperty$1(_assertThisInitialized(_this), "setQuaternion", function (_ref2) {
58754
58788
  var x = _ref2.x,
58755
58789
  y = _ref2.y,
@@ -58797,6 +58831,21 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
58797
58831
  value: function setBody(body) {
58798
58832
  this.body = body;
58799
58833
  }
58834
+ }, {
58835
+ key: "hasParent",
58836
+ value: function hasParent() {
58837
+ return !!this.parent;
58838
+ }
58839
+ }, {
58840
+ key: "getParent",
58841
+ value: function getParent() {
58842
+ return this.parent;
58843
+ }
58844
+ }, {
58845
+ key: "setParent",
58846
+ value: function setParent(parent) {
58847
+ this.parent = parent;
58848
+ }
58800
58849
  }, {
58801
58850
  key: "add",
58802
58851
  value: function add(element) {
@@ -58806,6 +58855,8 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
58806
58855
  var _add = function _add(toAdd) {
58807
58856
  _this2.children.push(toAdd);
58808
58857
 
58858
+ toAdd.setParent(_this2);
58859
+
58809
58860
  _this2.getBody().add(toAdd.getBody());
58810
58861
  };
58811
58862
 
@@ -58851,6 +58902,16 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
58851
58902
  this.children.splice(index, 1);
58852
58903
  }
58853
58904
  }
58905
+ }, {
58906
+ key: "getHierarchy",
58907
+ value: function getHierarchy() {
58908
+ return {
58909
+ element: this,
58910
+ children: this.children.map(function (e) {
58911
+ return e.getHierarchy();
58912
+ })
58913
+ };
58914
+ }
58854
58915
  }, {
58855
58916
  key: "addTags",
58856
58917
  value: function addTags() {
@@ -59071,7 +59132,7 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
59071
59132
  }, {
59072
59133
  key: "setEntityType",
59073
59134
  value: function setEntityType(type) {
59074
- if (Object.values(ENTITY_TYPES).includes(type)) {
59135
+ if (FLAT_ENTITY_TYPES.includes(type)) {
59075
59136
  this.entityType = type;
59076
59137
  } else {
59077
59138
  console.log(ENTITY_TYPE_NOT_ALLOWED);
@@ -59085,7 +59146,7 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
59085
59146
  }
59086
59147
  }, {
59087
59148
  key: "addLight",
59088
- // TODO: sounds should become like particle emitters
59149
+ // TODO: sounds should become entities
59089
59150
  // addSound(name, options) {
59090
59151
  // const { autoplay = false, ...opts } = options;
59091
59152
  // this.isPlayingSound = autoplay;
@@ -59414,6 +59475,7 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
59414
59475
 
59415
59476
  _this.mixer = new AnimationMixer(mesh);
59416
59477
  _this.animations = animations;
59478
+ _this.isPlayingAnimation = false;
59417
59479
 
59418
59480
  _this.addEventsListeners();
59419
59481
 
@@ -59451,6 +59513,7 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
59451
59513
  key: "stopAll",
59452
59514
  value: function stopAll() {
59453
59515
  this.mixer.stopAllAction();
59516
+ this.isPlayingAnimation = false;
59454
59517
  }
59455
59518
  }, {
59456
59519
  key: "stopCurrentAnimation",
@@ -59458,6 +59521,8 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
59458
59521
  if (this.currentAction) {
59459
59522
  this.currentAction.stop();
59460
59523
  }
59524
+
59525
+ this.isPlayingAnimation = false;
59461
59526
  }
59462
59527
  }, {
59463
59528
  key: "playAnimation",
@@ -59465,6 +59530,7 @@ var DEFAULT_TAG = 'all';var Entity = /*#__PURE__*/function (_EventDispatcher) {
59465
59530
  var action = this.getAction(id);
59466
59531
  var _options$loop = options.loop,
59467
59532
  loop = _options$loop === void 0 ? LoopRepeat : _options$loop;
59533
+ this.isPlayingAnimation = true;
59468
59534
 
59469
59535
  if (this.currentAction) {
59470
59536
  this.fadeToAnimation(action, options);
@@ -59954,7 +60020,7 @@ var AMBIENTLIGHT = 'ambientlight';
59954
60020
  var SUNLIGHT = 'sunlight';
59955
60021
  var SPOTLIGHT = 'spotlight';
59956
60022
  var HEMISPHERELIGHT = 'hemisphere';
59957
- var TIME_TO_UPDATE = 100;
60023
+ var TIME_TO_UPDATE = 5;
59958
60024
  var Lights = /*#__PURE__*/function () {
59959
60025
  function Lights() {
59960
60026
  _classCallCheck(this, Lights);
@@ -60211,10 +60277,10 @@ var Element = /*#__PURE__*/function (_Entity) {
60211
60277
 
60212
60278
  var _super = _createSuper(Element);
60213
60279
 
60214
- function Element(geometry, material) {
60280
+ function Element() {
60215
60281
  var _this;
60216
60282
 
60217
- var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
60283
+ var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
60218
60284
 
60219
60285
  _classCallCheck(this, Element);
60220
60286
 
@@ -60425,7 +60491,10 @@ var Element = /*#__PURE__*/function (_Entity) {
60425
60491
  });
60426
60492
 
60427
60493
  var _options$name = _options.name,
60428
- _name = _options$name === void 0 ? "default_".concat(Math.random()) : _options$name;
60494
+ _name = _options$name === void 0 ? "default_".concat(Math.random()) : _options$name,
60495
+ geometry = _options.geometry,
60496
+ material = _options.material,
60497
+ _body = _options.body;
60429
60498
 
60430
60499
  _this.textures = {};
60431
60500
  _this.opacity = 1;
@@ -60437,7 +60506,8 @@ var Element = /*#__PURE__*/function (_Entity) {
60437
60506
 
60438
60507
  _this.setBody({
60439
60508
  geometry: geometry,
60440
- material: material
60509
+ material: material,
60510
+ body: _body
60441
60511
  });
60442
60512
 
60443
60513
  _this.colliders = [];
@@ -60941,7 +61011,7 @@ var Element = /*#__PURE__*/function (_Entity) {
60941
61011
  this.checkCollisions();
60942
61012
  }
60943
61013
 
60944
- if (this.hasAnimationHandler()) {
61014
+ if (this.hasAnimationHandler() && this.animationHandler.isPlayingAnimation) {
60945
61015
  this.animationHandler.update(dt);
60946
61016
  }
60947
61017
  }
@@ -61004,6 +61074,10 @@ var Element = /*#__PURE__*/function (_Entity) {
61004
61074
 
61005
61075
  _this.setBody(new PerspectiveCamera(fov, ratio, near, far));
61006
61076
 
61077
+ _this.setEntityType(ENTITY_TYPES.CAMERA);
61078
+
61079
+ _this.setName(name);
61080
+
61007
61081
  return _this;
61008
61082
  }
61009
61083
 
@@ -61057,16 +61131,17 @@ var Element = /*#__PURE__*/function (_Entity) {
61057
61131
  size: size,
61058
61132
  division: division,
61059
61133
  color1: color1,
61060
- color2: color2
61134
+ color2: color2,
61135
+ name: "GridHelper_".concat(Math.random())
61061
61136
  };
61062
- _this = _super.call(this, null, null, options);
61137
+ _this = _super.call(this, options);
61063
61138
  var body = new GridHelper(size, division, color1, color2);
61064
61139
 
61065
61140
  _this.setBody({
61066
61141
  body: body
61067
61142
  });
61068
61143
 
61069
- _this.setEntityType(ENTITY_TYPES.MESH);
61144
+ _this.setEntityType(ENTITY_TYPES.HELPER.GRID);
61070
61145
 
61071
61146
  return _this;
61072
61147
  }
@@ -61091,7 +61166,7 @@ var Element = /*#__PURE__*/function (_Entity) {
61091
61166
 
61092
61167
  _classCallCheck(this, Cube);
61093
61168
 
61094
- _this = _super.call(this, null, null, options);
61169
+ _this = _super.call(this, options);
61095
61170
  var geometry = new BoxGeometry(side, side, side);
61096
61171
  var material = new MeshBasicMaterial(_objectSpread2$1({
61097
61172
  color: color,
@@ -61123,7 +61198,7 @@ var Element = /*#__PURE__*/function (_Entity) {
61123
61198
 
61124
61199
  _classCallCheck(this, Sphere);
61125
61200
 
61126
- _this = _super.call(this, null, null, options);
61201
+ _this = _super.call(this, options);
61127
61202
  var segments = 32;
61128
61203
  var geometry = new SphereGeometry(radius, segments, segments);
61129
61204
  var material = new MeshBasicMaterial(_objectSpread2$1({
@@ -61158,7 +61233,7 @@ var Element = /*#__PURE__*/function (_Entity) {
61158
61233
 
61159
61234
  _classCallCheck(this, Cylinder);
61160
61235
 
61161
- _this = _super.call(this, null, null, options);
61236
+ _this = _super.call(this, options);
61162
61237
  var segments = 32;
61163
61238
  var geometry = new CylinderGeometry(radiusTop, radiusBottom, height, segments);
61164
61239
  var material = new MeshBasicMaterial(_objectSpread2$1({
@@ -61194,7 +61269,7 @@ var Line = /*#__PURE__*/function (_Element) {
61194
61269
 
61195
61270
  _classCallCheck(this, Line);
61196
61271
 
61197
- _this = _super.call(this, null, null, options);
61272
+ _this = _super.call(this, options);
61198
61273
 
61199
61274
  _defineProperty$1(_assertThisInitialized(_this), "updatePoints", function (points) {
61200
61275
  var vectors = points.map(function (_ref) {
@@ -61328,7 +61403,7 @@ var Plane = /*#__PURE__*/function (_Element) {
61328
61403
 
61329
61404
  _classCallCheck(this, Plane);
61330
61405
 
61331
- _this = _super.call(this, null, null, options);
61406
+ _this = _super.call(this, options);
61332
61407
  var _options$color = options.color,
61333
61408
  color = _options$color === void 0 ? 0xfffffff : _options$color,
61334
61409
  _options$transparent = options.transparent,
@@ -61388,7 +61463,7 @@ var Plane = /*#__PURE__*/function (_Element) {
61388
61463
 
61389
61464
  _classCallCheck(this, Box);
61390
61465
 
61391
- _this = _super.call(this, null, null, options);
61466
+ _this = _super.call(this, options);
61392
61467
  var geometry = new BoxGeometry(width, height, depth);
61393
61468
  var material = new MeshBasicMaterial(_objectSpread2$1({
61394
61469
  color: color,
@@ -61428,7 +61503,7 @@ var Sprite = /*#__PURE__*/function (_Element) {
61428
61503
 
61429
61504
  _classCallCheck(this, Sprite);
61430
61505
 
61431
- _this = _super.call(this, null, null, options);
61506
+ _this = _super.call(this, options);
61432
61507
 
61433
61508
  var _options$anisotropy = options.anisotropy,
61434
61509
  anisotropy = _options$anisotropy === void 0 ? 1 : _options$anisotropy,
@@ -61480,7 +61555,7 @@ var Sprite = /*#__PURE__*/function (_Element) {
61480
61555
  (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});
61481
61556
  }(three_proton_min));
61482
61557
 
61483
- var Proton = three_proton_min.exports;var TIME_FOR_UPDATE = 150;
61558
+ var Proton = three_proton_min.exports;var TIME_FOR_UPDATE = 5;
61484
61559
  var VOLUME = 2;
61485
61560
  var AUDIO_EVENTS = {
61486
61561
  ENDED: 'ended'
@@ -72343,14 +72418,23 @@ var EXTENSIONS = {
72343
72418
  OBJ: 'obj'
72344
72419
  };
72345
72420
  var FULL_STOP = '.';
72346
- var loaders = (_loaders = {}, _defineProperty$1(_loaders, EXTENSIONS.JSON, new ObjectLoader()), _defineProperty$1(_loaders, EXTENSIONS.GLB, new GLTFLoader()), _defineProperty$1(_loaders, EXTENSIONS.GLTF, new GLTFLoader()), _defineProperty$1(_loaders, EXTENSIONS.FBX, new FBXLoader()), _defineProperty$1(_loaders, EXTENSIONS.OBJ, new OBJMTLLoader()), _loaders);
72421
+ var loaders = (_loaders = {}, _defineProperty$1(_loaders, EXTENSIONS.JSON, ObjectLoader), _defineProperty$1(_loaders, EXTENSIONS.GLB, GLTFLoader), _defineProperty$1(_loaders, EXTENSIONS.GLTF, GLTFLoader), _defineProperty$1(_loaders, EXTENSIONS.FBX, FBXLoader), _defineProperty$1(_loaders, EXTENSIONS.OBJ, OBJMTLLoader), _loaders);
72422
+ var loaderInstances = {};
72347
72423
 
72348
72424
  var extractExtension = function extractExtension(path) {
72349
72425
  return path.split(FULL_STOP).slice(-1).pop();
72350
72426
  };
72351
72427
 
72352
72428
  var getLoaderFromExtension = function getLoaderFromExtension(extension) {
72353
- return loaders[extension] || new ObjectLoader();
72429
+ var instance = loaderInstances[extension];
72430
+
72431
+ if (!instance) {
72432
+ var LoaderClass = loaders[extension] || ObjectLoader;
72433
+ instance = new LoaderClass();
72434
+ loaderInstances[extension] = instance;
72435
+ }
72436
+
72437
+ return instance;
72354
72438
  };
72355
72439
 
72356
72440
  var glbParser = function glbParser(_ref) {
@@ -72452,10 +72536,9 @@ var Models = function Models() {
72452
72536
  model = SkeletonUtils.clone(scene);
72453
72537
  }
72454
72538
 
72455
- var element = new Element(null, null, elementOptions);
72456
- element.setBody({
72539
+ var element = new Element(_objectSpread2$1({
72457
72540
  body: prepareModel(model)
72458
- });
72541
+ }, elementOptions));
72459
72542
  element.setEntityType(ENTITY_TYPES.MODEL);
72460
72543
 
72461
72544
  if (hasAnimations(animations)) {
@@ -73471,11 +73554,6 @@ var Stats = /*#__PURE__*/function () {
73471
73554
  this._fps = 0;
73472
73555
  this._fpsMax = 100;
73473
73556
  this.fps = new Subject();
73474
- this.hasMemoryUsage = Features$1.isFeatureSupported(FEATURES.MEMORY);
73475
-
73476
- if (this.hasMemoryUsage) {
73477
- this.collectMemoryUsage();
73478
- }
73479
73557
  }
73480
73558
 
73481
73559
  _createClass(Stats, [{
@@ -73500,33 +73578,27 @@ var Stats = /*#__PURE__*/function () {
73500
73578
  return this._fps;
73501
73579
  }
73502
73580
  }, {
73503
- key: "collectMemoryUsage",
73504
- value: function collectMemoryUsage() {
73505
- this.memory = performance.memory.usedJSHeapSize / ONE_MB;
73506
- this.memoryMax = performance.memory.jsHeapSizeLimit / ONE_MB;
73581
+ key: "subscribe",
73582
+ value: function subscribe(handler) {
73583
+ var _this = this;
73584
+
73585
+ this.fps.subscribe(handler);
73586
+ return function () {
73587
+ return _this.fps.unsubscribe(handler);
73588
+ };
73507
73589
  }
73508
73590
  }, {
73509
- key: "getMemory",
73510
- value: function getMemory() {
73511
- this.frames++;
73512
- var time = (performance || Date).now();
73513
-
73514
- if (time >= this.prevTime + 1000) {
73515
- this.prevTime = time;
73516
- this.frames = 0;
73517
- this.collectMemoryUsage();
73591
+ key: "getMemoryUsage",
73592
+ value: function getMemoryUsage() {
73593
+ if (Features$1.isFeatureSupported(FEATURES.MEMORY)) {
73594
+ this.memory = performance.memory.usedJSHeapSize / ONE_MB;
73595
+ this.memoryMax = performance.memory.jsHeapSizeLimit / ONE_MB;
73518
73596
  }
73519
-
73520
- this.beginTime = time;
73521
73597
  }
73522
73598
  }, {
73523
73599
  key: "update",
73524
73600
  value: function update() {
73525
73601
  this.getFPS();
73526
-
73527
- if (this.hasMemoryUsage) {
73528
- this.getMemory();
73529
- }
73530
73602
  }
73531
73603
  }]);
73532
73604
 
@@ -73587,13 +73659,21 @@ var MeshLoader = /*#__PURE__*/function (_Loader) {
73587
73659
  }
73588
73660
  }, {
73589
73661
  key: "loadMesh",
73590
- value: function loadMesh(parsedMesh, scripts, texture, elementOptions) {
73662
+ value: function loadMesh(_ref2, scripts, texture, elementOptions) {
73663
+ var geometry = _ref2.geometry,
73664
+ material = _ref2.material,
73665
+ position = _ref2.position,
73666
+ rotation = _ref2.rotation,
73667
+ scale = _ref2.scale;
73591
73668
  var _this$options$scriptE = this.options.scriptEnabled,
73592
73669
  scriptEnabled = _this$options$scriptE === void 0 ? true : _this$options$scriptE;
73593
- var element = new Element(parsedMesh.geometry, parsedMesh.material, elementOptions);
73594
- element.setPosition(_objectSpread2$1({}, parsedMesh.position));
73595
- element.setRotation(_objectSpread2$1({}, parsedMesh.rotation));
73596
- element.setScale(_objectSpread2$1({}, parsedMesh.scale));
73670
+ var element = new Element(_objectSpread2$1({
73671
+ geometry: geometry,
73672
+ material: material
73673
+ }, elementOptions));
73674
+ element.setPosition(_objectSpread2$1({}, position));
73675
+ element.setRotation(_objectSpread2$1({}, rotation));
73676
+ element.setScale(_objectSpread2$1({}, scale));
73597
73677
 
73598
73678
  if (scripts && scripts.length) {
73599
73679
  element.addScripts(scripts.names, scripts.options, scriptEnabled);
@@ -73662,7 +73742,7 @@ var Light = /*#__PURE__*/function (_Entity) {
73662
73742
 
73663
73743
  _this.target = undefined;
73664
73744
 
73665
- _this.setEntityType(ENTITY_TYPES.LIGHT);
73745
+ _this.setEntityType(ENTITY_TYPES.LIGHT.DEFAULT);
73666
73746
 
73667
73747
  Lights$1.add(_assertThisInitialized(_this));
73668
73748
  return _this;
@@ -73837,7 +73917,8 @@ var SunLight = /*#__PURE__*/function (_Light) {
73837
73917
  color = _options$color === void 0 ? WHITE$3 : _options$color,
73838
73918
  _options$intensity = options.intensity,
73839
73919
  intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$4 : _options$intensity,
73840
- name = options.name;
73920
+ _options$name = options.name,
73921
+ name = _options$name === void 0 ? "SunLight_".concat(Math.random()) : _options$name;
73841
73922
  _this = _super.call(this, {
73842
73923
  color: color,
73843
73924
  intensity: intensity,
@@ -73850,6 +73931,10 @@ var SunLight = /*#__PURE__*/function (_Light) {
73850
73931
  intensity: intensity
73851
73932
  });
73852
73933
 
73934
+ _this.setEntityType(ENTITY_TYPES.LIGHT.SUN);
73935
+
73936
+ _this.setName(name);
73937
+
73853
73938
  return _this;
73854
73939
  }
73855
73940
 
@@ -73926,7 +74011,10 @@ var SunLight = /*#__PURE__*/function (_Light) {
73926
74011
  color: 0xeeeeee,
73927
74012
  wireframe: true
73928
74013
  });
73929
- var target = new Element(geometry, material);
74014
+ var target = new Element({
74015
+ geometry: geometry,
74016
+ material: material
74017
+ });
73930
74018
  target.position(initialPosition);
73931
74019
  return target;
73932
74020
  }
@@ -74000,7 +74088,8 @@ var AmbientLight = /*#__PURE__*/function (_Light) {
74000
74088
  color = _options$color === void 0 ? WHITE$2 : _options$color,
74001
74089
  _options$intensity = options.intensity,
74002
74090
  intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$3 : _options$intensity,
74003
- name = options.name;
74091
+ _options$name = options.name,
74092
+ name = _options$name === void 0 ? "AmbientLight_".concat(Math.random()) : _options$name;
74004
74093
  _this = _super.call(this, {
74005
74094
  color: color,
74006
74095
  intensity: intensity,
@@ -74013,6 +74102,10 @@ var AmbientLight = /*#__PURE__*/function (_Light) {
74013
74102
  intensity: intensity
74014
74103
  });
74015
74104
 
74105
+ _this.setEntityType(ENTITY_TYPES.LIGHT.AMBIENT);
74106
+
74107
+ _this.setName(name);
74108
+
74016
74109
  return _this;
74017
74110
  }
74018
74111
 
@@ -74099,7 +74192,8 @@ var PointLight = /*#__PURE__*/function (_Light) {
74099
74192
  color = _options$color === void 0 ? WHITE$1 : _options$color,
74100
74193
  _options$intensity = options.intensity,
74101
74194
  intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$2 : _options$intensity,
74102
- name = options.name,
74195
+ _options$name = options.name,
74196
+ name = _options$name === void 0 ? "PointLight_".concat(Math.random()) : _options$name,
74103
74197
  distance = options.distance,
74104
74198
  decay = options.decay;
74105
74199
  _this = _super.call(this, {
@@ -74116,6 +74210,10 @@ var PointLight = /*#__PURE__*/function (_Light) {
74116
74210
  decay: decay
74117
74211
  });
74118
74212
 
74213
+ _this.setEntityType(ENTITY_TYPES.LIGHT.POINT);
74214
+
74215
+ _this.setName(name);
74216
+
74119
74217
  return _this;
74120
74218
  }
74121
74219
 
@@ -74327,11 +74425,11 @@ var LightLoader$1 = new LightLoader();var Pass = /*#__PURE__*/function () {
74327
74425
 
74328
74426
  _createClass(Pass, [{
74329
74427
  key: "setSize",
74330
- value: function setSize(width, height) {}
74428
+ value: function setSize() {}
74331
74429
  }, {
74332
74430
  key: "render",
74333
- value: function render(renderer, writeBuffer, readBuffer, delta, maskActive) {
74334
- console.error('Pass: .render() must be implemented in derived pass.');
74431
+ value: function render() {
74432
+ console.error('THREE.Pass: .render() must be implemented in derived pass.');
74335
74433
  }
74336
74434
  }]);
74337
74435
 
@@ -74386,7 +74484,7 @@ var FullScreenQuad = /*#__PURE__*/function () {
74386
74484
  _classCallCheck(this, ShaderPass);
74387
74485
 
74388
74486
  _this = _super.call(this);
74389
- _this.textureID = textureID !== undefined ? textureID : "tDiffuse";
74487
+ _this.textureID = textureID !== undefined ? textureID : 'tDiffuse';
74390
74488
 
74391
74489
  if (shader instanceof ShaderMaterial) {
74392
74490
  _this.uniforms = shader.uniforms;
@@ -74407,7 +74505,9 @@ var FullScreenQuad = /*#__PURE__*/function () {
74407
74505
 
74408
74506
  _createClass(ShaderPass, [{
74409
74507
  key: "render",
74410
- value: function render(renderer, writeBuffer, readBuffer) {
74508
+ value: function render(renderer, writeBuffer, readBuffer
74509
+ /*, deltaTime, maskActive */
74510
+ ) {
74411
74511
  if (this.uniforms[this.textureID]) {
74412
74512
  this.uniforms[this.textureID].value = readBuffer.texture;
74413
74513
  }
@@ -74428,21 +74528,23 @@ var FullScreenQuad = /*#__PURE__*/function () {
74428
74528
 
74429
74529
  return ShaderPass;
74430
74530
  }(Pass);/**
74431
- * @author alteredq / http://alteredqualia.com/
74432
- *
74433
74531
  * Full-screen textured quad shader
74434
74532
  */
74435
74533
  var CopyShader = {
74436
74534
  uniforms: {
74437
- "tDiffuse": {
74535
+ 'tDiffuse': {
74438
74536
  value: null
74439
74537
  },
74440
- "opacity": {
74538
+ 'opacity': {
74441
74539
  value: 1.0
74442
74540
  }
74443
74541
  },
74444
- vertexShader: ["varying vec2 vUv;", "void main() {", " vUv = uv;", " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
74445
- fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", " vec4 texel = texture2D( tDiffuse, vUv );", " gl_FragColor = opacity * texel;", "}"].join("\n")
74542
+ vertexShader:
74543
+ /* glsl */
74544
+ "\n\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
74545
+ fragmentShader:
74546
+ /* glsl */
74547
+ "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( tDiffuse, vUv );\n gl_FragColor.a *= opacity;\n }"
74446
74548
  };var MaskPass = /*#__PURE__*/function (_Pass) {
74447
74549
  _inherits(MaskPass, _Pass);
74448
74550
 
@@ -74464,7 +74566,9 @@ var CopyShader = {
74464
74566
 
74465
74567
  _createClass(MaskPass, [{
74466
74568
  key: "render",
74467
- value: function render(renderer, writeBuffer, readBuffer) {
74569
+ value: function render(renderer, writeBuffer, readBuffer
74570
+ /*, deltaTime, maskActive */
74571
+ ) {
74468
74572
  var context = renderer.getContext();
74469
74573
  var state = renderer.state; // don't update color or depth
74470
74574
 
@@ -74526,7 +74630,9 @@ var CopyShader = {
74526
74630
 
74527
74631
  _createClass(ClearMaskPass, [{
74528
74632
  key: "render",
74529
- value: function render(renderer, writeBuffer, readBuffer, delta, maskActive) {
74633
+ value: function render(renderer
74634
+ /*, writeBuffer, readBuffer, deltaTime, maskActive */
74635
+ ) {
74530
74636
  renderer.state.buffers.stencil.setLocked(false);
74531
74637
  renderer.state.buffers.stencil.setTest(false);
74532
74638
  }
@@ -74548,16 +74654,11 @@ var CopyShader = {
74548
74654
  this.renderer = renderer;
74549
74655
 
74550
74656
  if (renderTarget === undefined) {
74551
- var parameters = {
74552
- minFilter: LinearFilter,
74553
- magFilter: LinearFilter,
74554
- format: RGBAFormat
74555
- };
74556
74657
  var size = renderer.getSize(new Vector2());
74557
74658
  this._pixelRatio = renderer.getPixelRatio();
74558
74659
  this._width = size.width;
74559
74660
  this._height = size.height;
74560
- renderTarget = new WebGLRenderTarget(this._width * this._pixelRatio, this._height * this._pixelRatio, parameters);
74661
+ renderTarget = new WebGLRenderTarget(this._width * this._pixelRatio, this._height * this._pixelRatio);
74561
74662
  renderTarget.texture.name = 'EffectComposer.rt1';
74562
74663
  } else {
74563
74664
  this._pixelRatio = 1;
@@ -74574,11 +74675,11 @@ var CopyShader = {
74574
74675
  this.passes = []; // dependencies
74575
74676
 
74576
74677
  if (CopyShader === undefined) {
74577
- console.error('EffectComposer relies on CopyShader');
74678
+ console.error('THREE.EffectComposer relies on CopyShader');
74578
74679
  }
74579
74680
 
74580
74681
  if (ShaderPass === undefined) {
74581
- console.error('EffectComposer relies on ShaderPass');
74682
+ console.error('THREE.EffectComposer relies on ShaderPass');
74582
74683
  }
74583
74684
 
74584
74685
  this.copyPass = new ShaderPass(CopyShader);
@@ -74634,12 +74735,9 @@ var CopyShader = {
74634
74735
 
74635
74736
  var currentRenderTarget = this.renderer.getRenderTarget();
74636
74737
  var maskActive = false;
74637
- var pass,
74638
- i,
74639
- il = this.passes.length;
74640
74738
 
74641
- for (i = 0; i < il; i++) {
74642
- pass = this.passes[i];
74739
+ for (var i = 0, il = this.passes.length; i < il; i++) {
74740
+ var pass = this.passes[i];
74643
74741
  if (pass.enabled === false) continue;
74644
74742
  pass.renderToScreen = this.renderToScreen && this.isLastEnabledPass(i);
74645
74743
  pass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive);
@@ -74716,13 +74814,9 @@ var CopyShader = {
74716
74814
 
74717
74815
  var _super = _createSuper(RenderPass);
74718
74816
 
74719
- function RenderPass(scene, camera) {
74817
+ function RenderPass(scene, camera, overrideMaterial, clearColor, clearAlpha) {
74720
74818
  var _this;
74721
74819
 
74722
- var overrideMaterial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
74723
- var clearColor = arguments.length > 3 ? arguments[3] : undefined;
74724
- var clearAlpha = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
74725
-
74726
74820
  _classCallCheck(this, RenderPass);
74727
74821
 
74728
74822
  _this = _super.call(this);
@@ -74730,7 +74824,7 @@ var CopyShader = {
74730
74824
  _this.camera = camera;
74731
74825
  _this.overrideMaterial = overrideMaterial;
74732
74826
  _this.clearColor = clearColor;
74733
- _this.clearAlpha = clearAlpha;
74827
+ _this.clearAlpha = clearAlpha !== undefined ? clearAlpha : 0;
74734
74828
  _this.clear = true;
74735
74829
  _this.clearDepth = false;
74736
74830
  _this.needsSwap = false;
@@ -74740,7 +74834,9 @@ var CopyShader = {
74740
74834
 
74741
74835
  _createClass(RenderPass, [{
74742
74836
  key: "render",
74743
- value: function render(renderer, writeBuffer, readBuffer) {
74837
+ value: function render(renderer, writeBuffer, readBuffer
74838
+ /*, deltaTime, maskActive */
74839
+ ) {
74744
74840
  var oldAutoClear = renderer.autoClear;
74745
74841
  renderer.autoClear = false;
74746
74842
  var oldClearAlpha, oldOverrideMaterial;
@@ -75207,6 +75303,9 @@ var PALETTES = {
75207
75303
  FRENCH: FRENCH_PALETTE
75208
75304
  };var MAX_EDGE_THICKNESS = 4;
75209
75305
  var MAX_EDGE_GLOW = 4;
75306
+ var DEFAULT_EDGE_GLOW = 0.0;
75307
+ var DEFAULT_EDGE_THICKNES = 1.0;
75308
+ var DEFAULT_EDGE_STRENGTH = 10.0;
75210
75309
  var BlurDirectionX = new Vector2(1.0, 0.0);
75211
75310
  var BlurDirectionY = new Vector2(0.0, 1.0);
75212
75311
 
@@ -75225,15 +75324,17 @@ var SelectiveOutline = /*#__PURE__*/function (_Pass) {
75225
75324
 
75226
75325
  var _ref$resolution = _ref.resolution,
75227
75326
  resolution = _ref$resolution === void 0 ? {} : _ref$resolution,
75228
- selectedObjects = _ref.selectedObjects,
75327
+ _ref$selectedObjects = _ref.selectedObjects,
75328
+ selectedObjects = _ref$selectedObjects === void 0 ? [] : _ref$selectedObjects,
75229
75329
  _ref$visibleEdgeColor = _ref.visibleEdgeColor,
75230
75330
  visibleEdgeColor = _ref$visibleEdgeColor === void 0 ? PALETTES.BASE.WHITE : _ref$visibleEdgeColor,
75231
75331
  _ref$hiddenEdgeColor = _ref.hiddenEdgeColor,
75232
- hiddenEdgeColor = _ref$hiddenEdgeColor === void 0 ? PALETTES.BASE.BLACK : _ref$hiddenEdgeColor;
75332
+ hiddenEdgeColor = _ref$hiddenEdgeColor === void 0 ? PALETTES.BASE.WHITE : _ref$hiddenEdgeColor;
75233
75333
 
75234
75334
  _classCallCheck(this, SelectiveOutline);
75235
75335
 
75236
75336
  _this = _super.call(this);
75337
+ _this.isPass = true;
75237
75338
 
75238
75339
  var _config$screen = Config$1.screen(),
75239
75340
  height = _config$screen.h,
@@ -75245,13 +75346,13 @@ var SelectiveOutline = /*#__PURE__*/function (_Pass) {
75245
75346
  resolutionY = _resolution$y === void 0 ? height : _resolution$y;
75246
75347
  _this.renderScene = Scene$1.getScene();
75247
75348
  _this.renderCamera = Scene$1.getCameraBody();
75248
- _this.selectedObjects = selectedObjects !== undefined ? selectedObjects : [];
75249
- _this.visibleEdgeColor = visibleEdgeColor;
75250
- _this.hiddenEdgeColor = hiddenEdgeColor;
75251
- _this.edgeGlow = 0.0;
75349
+ _this.selectedObjects = selectedObjects;
75350
+ _this.visibleEdgeColor = new Color$1(visibleEdgeColor);
75351
+ _this.hiddenEdgeColor = new Color$1(hiddenEdgeColor);
75352
+ _this.edgeGlow = DEFAULT_EDGE_GLOW;
75252
75353
  _this.usePatternTexture = false;
75253
- _this.edgeThickness = 1.0;
75254
- _this.edgeStrength = 3.0;
75354
+ _this.edgeThickness = DEFAULT_EDGE_THICKNES;
75355
+ _this.edgeStrength = DEFAULT_EDGE_STRENGTH;
75255
75356
  _this.downSampleRatio = 2;
75256
75357
  _this.pulsePeriod = 0;
75257
75358
  _this._visibilityCache = new Map();
@@ -75337,6 +75438,36 @@ var SelectiveOutline = /*#__PURE__*/function (_Pass) {
75337
75438
  return o.getBody();
75338
75439
  });
75339
75440
  }
75441
+ }, {
75442
+ key: "setVisibleEdgeColor",
75443
+ value: function setVisibleEdgeColor() {
75444
+ var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PALETTES.BASE.WHITE;
75445
+ this.visibleEdgeColor = new Color$1(color);
75446
+ }
75447
+ }, {
75448
+ key: "setHiddenEdgeColor",
75449
+ value: function setHiddenEdgeColor() {
75450
+ var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PALETTES.BASE.WHITE;
75451
+ this.hiddenEdgeColor = new Color$1(color);
75452
+ }
75453
+ }, {
75454
+ key: "setEdgeGlow",
75455
+ value: function setEdgeGlow() {
75456
+ var glow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_EDGE_GLOW;
75457
+ this.edgeGlow = glow;
75458
+ }
75459
+ }, {
75460
+ key: "setEdgeStrength",
75461
+ value: function setEdgeStrength() {
75462
+ var strength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_EDGE_STRENGTH;
75463
+ this.edgeStrength = strength;
75464
+ }
75465
+ }, {
75466
+ key: "setEdgeThickness",
75467
+ value: function setEdgeThickness() {
75468
+ var thickness = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_EDGE_THICKNES;
75469
+ this.edgeThickness = thickness;
75470
+ }
75340
75471
  }, {
75341
75472
  key: "dispose",
75342
75473
  value: function dispose() {
@@ -75505,8 +75636,8 @@ var SelectiveOutline = /*#__PURE__*/function (_Pass) {
75505
75636
  this.fsQuad.material = this.edgeDetectionMaterial;
75506
75637
  this.edgeDetectionMaterial.uniforms['maskTexture'].value = this.renderTargetMaskDownSampleBuffer.texture;
75507
75638
  this.edgeDetectionMaterial.uniforms['texSize'].value.set(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height);
75508
- this.edgeDetectionMaterial.uniforms['visibleEdgeColor'].value = this.tempPulseColor1;
75509
- this.edgeDetectionMaterial.uniforms['hiddenEdgeColor'].value = this.tempPulseColor2;
75639
+ this.edgeDetectionMaterial.uniforms['visibleEdgeColor'].value.set(this.tempPulseColor1.getHex());
75640
+ this.edgeDetectionMaterial.uniforms['hiddenEdgeColor'].value.set(this.tempPulseColor2.getHex());
75510
75641
  renderer.setRenderTarget(this.renderTargetEdgeBuffer1);
75511
75642
  renderer.clear();
75512
75643
  this.fsQuad.render(renderer); // 4. Apply Blur on Half res
@@ -75589,10 +75720,10 @@ var SelectiveOutline = /*#__PURE__*/function (_Pass) {
75589
75720
  value: new Vector2(0.5, 0.5)
75590
75721
  },
75591
75722
  'visibleEdgeColor': {
75592
- value: new Vector3$1(1.0, 1.0, 1.0)
75723
+ value: new Color$1(1.0, 1.0, 1.0)
75593
75724
  },
75594
75725
  'hiddenEdgeColor': {
75595
- value: new Vector3$1(1.0, 1.0, 1.0)
75726
+ value: new Color$1(1.0, 1.0, 1.0)
75596
75727
  }
75597
75728
  },
75598
75729
  vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",
@@ -76294,14 +76425,22 @@ var OutlineEffect = /*#__PURE__*/function () {
76294
76425
  _classCallCheck(this, PostProcessing);
76295
76426
 
76296
76427
  _defineProperty$1(this, "isEnabled", function () {
76297
- return !!_this.effects.length || !!_this.customs.length;
76428
+ return _this.enabled && (!!_this.effects.length || !!_this.customs.length);
76298
76429
  });
76299
76430
 
76300
76431
  _defineProperty$1(this, "init", function () {
76301
- window.addEventListener('resize', _this.onWindowResize, false);
76302
- _this.composer = new EffectComposer(Scene$1.getRenderer());
76432
+ var _Config$postprocessin = Config$1.postprocessing(),
76433
+ _Config$postprocessin2 = _Config$postprocessin.enabled,
76434
+ enabled = _Config$postprocessin2 === void 0 ? false : _Config$postprocessin2;
76303
76435
 
76304
- _this.composer.addPass(new RenderPass(Scene$1.getScene(), Scene$1.getCameraBody()));
76436
+ _this.enabled = enabled;
76437
+
76438
+ if (enabled) {
76439
+ window.addEventListener('resize', _this.onWindowResize, false);
76440
+ _this.composer = new EffectComposer(Scene$1.getRenderer());
76441
+
76442
+ _this.composer.addPass(new RenderPass(Scene$1.getScene(), Scene$1.getCameraBody()));
76443
+ }
76305
76444
  });
76306
76445
 
76307
76446
  _defineProperty$1(this, "dispose", function () {
@@ -76364,14 +76503,6 @@ var OutlineEffect = /*#__PURE__*/function () {
76364
76503
  }
76365
76504
  });
76366
76505
 
76367
- _defineProperty$1(this, "render", function (dt) {
76368
- _this.composer.render(dt);
76369
-
76370
- _this.customs.forEach(function (e) {
76371
- return e.render(Scene$1.getScene(), Scene$1.getCameraBody(), dt);
76372
- });
76373
- });
76374
-
76375
76506
  this.map = (_this$map = {}, _defineProperty$1(_this$map, EFFECTS.SEPIA, {
76376
76507
  effect: SepiaEffect,
76377
76508
  isClass: false
@@ -76399,6 +76530,7 @@ var OutlineEffect = /*#__PURE__*/function () {
76399
76530
  }), _this$map);
76400
76531
  this.effects = [];
76401
76532
  this.customs = [];
76533
+ this.enabled = false;
76402
76534
  }
76403
76535
 
76404
76536
  _createClass(PostProcessing, [{
@@ -76406,6 +76538,16 @@ var OutlineEffect = /*#__PURE__*/function () {
76406
76538
  value: function get(id) {
76407
76539
  return this.map[id] || null;
76408
76540
  }
76541
+ }, {
76542
+ key: "render",
76543
+ value: function render(dt) {
76544
+ var scene = Scene$1.getScene();
76545
+ var camera = Scene$1.getCameraBody();
76546
+ this.composer.render(dt);
76547
+ this.customs.forEach(function (e) {
76548
+ return e.render(scene, camera, dt);
76549
+ });
76550
+ }
76409
76551
  }], [{
76410
76552
  key: "createEffect",
76411
76553
  value: function createEffect(_ref, options) {
@@ -76458,7 +76600,7 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
76458
76600
 
76459
76601
  _this.setName(name);
76460
76602
 
76461
- _this.setEntityType(ENTITY_TYPES.PARTICLE);
76603
+ _this.setEntityType(ENTITY_TYPES.EFFECT.PARTICLE);
76462
76604
 
76463
76605
  return _this;
76464
76606
  }
@@ -77221,11 +77363,7 @@ var Particles = /*#__PURE__*/function () {
77221
77363
  _defineProperty$1(this, "updateEmitters", function (dt) {
77222
77364
  _this.toDispose = [];
77223
77365
  Object.keys(_this.emitters).forEach(function (uuid) {
77224
- var emitter = _this.emitters[uuid]; // if (emitter.getType() === GROUP) {
77225
- // emitter.forEach(emitter => this.updateSingleEmitter(emitter, dt));
77226
- // } else {
77227
- // this.updateSingleEmitter(emitter, dt);
77228
- // }
77366
+ var emitter = _this.emitters[uuid];
77229
77367
 
77230
77368
  _this.updateSingleEmitter(emitter, dt);
77231
77369
  });
@@ -78402,7 +78540,7 @@ var Particles$1 = new Particles();var Orbit = /*#__PURE__*/function (_EventDispa
78402
78540
  _this.scaleHandleGeometry = new BoxGeometry(0.125, 0.125, 0.125);
78403
78541
  _this.lineGeometry = new BufferGeometry();
78404
78542
 
78405
- _this.lineGeometry.addAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3)); // Make unique material for each axis/color
78543
+ _this.lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3)); // Make unique material for each axis/color
78406
78544
 
78407
78545
 
78408
78546
  _this.matInvisible = _this.gizmoMaterial.clone();
@@ -78521,14 +78659,14 @@ var Particles$1 = new Particles();var Orbit = /*#__PURE__*/function (_EventDispa
78521
78659
  vertices.push(0, Math.cos(i / 32 * Math.PI) * radius, Math.sin(i / 32 * Math.PI) * radius);
78522
78660
  }
78523
78661
 
78524
- geometry.addAttribute('position', new Float32BufferAttribute(vertices, 3));
78662
+ geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
78525
78663
  return geometry;
78526
78664
  }
78527
78665
  }, {
78528
78666
  key: "createTranslateHelperGeometry",
78529
78667
  value: function createTranslateHelperGeometry(radius, arc) {
78530
78668
  var geometry = new BufferGeometry();
78531
- geometry.addAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
78669
+ geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
78532
78670
  return geometry;
78533
78671
  }
78534
78672
  }, {
@@ -78667,7 +78805,7 @@ var Particles$1 = new Particles();var Orbit = /*#__PURE__*/function (_EventDispa
78667
78805
 
78668
78806
  object.updateMatrix();
78669
78807
  var tempGeometry = object.geometry.clone();
78670
- tempGeometry.applyMatrix(object.matrix);
78808
+ tempGeometry.applyMatrix4(object.matrix);
78671
78809
  object.geometry = tempGeometry;
78672
78810
  object.position.set(0, 0, 0);
78673
78811
  object.rotation.set(0, 0, 0);
@@ -79359,7 +79497,7 @@ var Particles$1 = new Particles();var Orbit = /*#__PURE__*/function (_EventDispa
79359
79497
  _this._quaternionStart = new Quaternion();
79360
79498
  _this._scaleStart = new Vector3$1();
79361
79499
  _this.isTransformControls = true;
79362
- Scene$1.add(_assertThisInitialized(_this), _assertThisInitialized(_this), false);
79500
+ Scene$1.add(_assertThisInitialized(_this), null, false);
79363
79501
  return _this;
79364
79502
  }
79365
79503
 
@@ -80516,7 +80654,6 @@ var Controls = /*#__PURE__*/function () {
80516
80654
  this.controls[CONTROLS.ORBIT] = new Orbit(Scene$1.getCameraBody(), Scene$1.getDOMElement());
80517
80655
  this.controls[CONTROLS.ORBIT].init();
80518
80656
  this.controls[CONTROLS.ORBIT].setTarget(target);
80519
- this.controls[CONTROLS.ORBIT].addEventListener(EVENTS.CHANGE, Scene$1.render);
80520
80657
  return this.controls[CONTROLS.ORBIT];
80521
80658
  }
80522
80659
  }, {
@@ -80571,37 +80708,6 @@ var Level = /*#__PURE__*/function (_EventDispatcher) {
80571
80708
 
80572
80709
  _defineProperty$1(_assertThisInitialized(_this), "onStateChange", function (state) {});
80573
80710
 
80574
- _defineProperty$1(_assertThisInitialized(_this), "enableInput", function () {
80575
- Input$1.enable();
80576
-
80577
- if (!_this.inputListenersAreSet) {
80578
- INPUT_EVENTS_LIST.forEach(function (event) {
80579
- var methodName = "on".concat(upperCaseFirst(event));
80580
-
80581
- if (typeof _this[methodName] === 'function') {
80582
- Input$1.addEventListener(event, _this[methodName].bind(_assertThisInitialized(_this)));
80583
- }
80584
- });
80585
- _this.inputListenersAreSet = true;
80586
-
80587
- _this.onInputEnabled();
80588
- }
80589
- });
80590
-
80591
- _defineProperty$1(_assertThisInitialized(_this), "disableInput", function () {
80592
- Input$1.disable();
80593
- INPUT_EVENTS_LIST.forEach(function (event) {
80594
- var methodName = "on".concat(upperCaseFirst(event));
80595
-
80596
- if (typeof _this[methodName] === 'function') {
80597
- Input$1.removeEventListener(event, _this[methodName]);
80598
- }
80599
- });
80600
- _this.inputListenersAreSet = false;
80601
-
80602
- _this.onInputDisabled();
80603
- });
80604
-
80605
80711
  _defineProperty$1(_assertThisInitialized(_this), "parseScene", function (_ref) {
80606
80712
  var _ref$elements = _ref.elements,
80607
80713
  elements = _ref$elements === void 0 ? [] : _ref$elements,
@@ -80651,38 +80757,14 @@ var Level = /*#__PURE__*/function (_EventDispatcher) {
80651
80757
  return _this.loadScene(url);
80652
80758
  });
80653
80759
 
80654
- _defineProperty$1(_assertThisInitialized(_this), "requestNextAnimationFrame", function () {
80655
- _this.requestAnimationFrameId = requestNextFrame(_this.render.bind(_assertThisInitialized(_this)));
80656
- });
80657
-
80658
80760
  _defineProperty$1(_assertThisInitialized(_this), "cancelNextAnimationFrame", function () {
80659
80761
  cancelAnimationFrame(_this.requestAnimationFrameId);
80660
80762
  });
80661
80763
 
80662
- _defineProperty$1(_assertThisInitialized(_this), "render", function () {
80663
- var dt = Scene$1.clock.getDelta();
80664
- Scene$1.render(dt);
80665
- Particles$1.update(dt);
80666
- PostProcessing$1.render(dt);
80667
-
80668
- _this.onUpdate(dt);
80669
-
80670
- Scene$1.update(dt);
80671
- Assets$1.update(dt);
80672
- Stats$1.update(dt);
80673
- Controls$1.update(dt);
80674
- Input$1.update(dt);
80675
-
80676
- _this.requestNextAnimationFrame();
80677
- });
80678
-
80679
80764
  _defineProperty$1(_assertThisInitialized(_this), "init", function () {
80680
- var path = _this.options.path;
80681
- Scene$1.create(path);
80765
+ _this.options.path;
80766
+ Scene$1.create(_this.getName());
80682
80767
  Scene$1.createCamera(new Camera());
80683
-
80684
- _this.enableInput();
80685
-
80686
80768
  Physics$1.init().then(function () {
80687
80769
  Particles$1.init();
80688
80770
  PostProcessing$1.init();
@@ -80701,8 +80783,6 @@ var Level = /*#__PURE__*/function (_EventDispatcher) {
80701
80783
  _defineProperty$1(_assertThisInitialized(_this), "dispose", function () {
80702
80784
  _this.onBeforeDispose();
80703
80785
 
80704
- _this.disableInput();
80705
-
80706
80786
  Physics$1.dispose();
80707
80787
  Audio$1.dispose();
80708
80788
  Particles$1.dispose();
@@ -80720,10 +80800,16 @@ var Level = /*#__PURE__*/function (_EventDispatcher) {
80720
80800
  _this.name = _this.constructor.name;
80721
80801
  _this.debug = true;
80722
80802
  _this.inputListenersAreSet = false;
80803
+ _this.render = _this.render.bind(_assertThisInitialized(_this));
80723
80804
  return _this;
80724
80805
  }
80725
80806
 
80726
80807
  _createClass(Level, [{
80808
+ key: "getName",
80809
+ value: function getName() {
80810
+ return this.name;
80811
+ }
80812
+ }, {
80727
80813
  key: "prepareScene",
80728
80814
  value: function prepareScene() {}
80729
80815
  }, {
@@ -80750,6 +80836,31 @@ var Level = /*#__PURE__*/function (_EventDispatcher) {
80750
80836
  }, {
80751
80837
  key: "onInputDisabled",
80752
80838
  value: function onInputDisabled() {}
80839
+ }, {
80840
+ key: "requestNextAnimationFrame",
80841
+ value: function requestNextAnimationFrame() {
80842
+ this.requestAnimationFrameId = requestNextFrame(this.render);
80843
+ }
80844
+ }, {
80845
+ key: "render",
80846
+ value: function render() {
80847
+ var dt = Scene$1.clock.getDelta();
80848
+
80849
+ if (PostProcessing$1.isEnabled()) {
80850
+ PostProcessing$1.render(dt);
80851
+ } else {
80852
+ Scene$1.render(dt);
80853
+ }
80854
+
80855
+ Particles$1.update(dt);
80856
+ this.onUpdate(dt);
80857
+ Scene$1.update(dt);
80858
+ Assets$1.update(dt);
80859
+ Stats$1.update(dt);
80860
+ Controls$1.update(dt);
80861
+ Input$1.update(dt);
80862
+ this.requestNextAnimationFrame();
80863
+ }
80753
80864
  }, {
80754
80865
  key: "toJSON",
80755
80866
  value: function toJSON() {
@@ -86560,7 +86671,8 @@ var SpotLight = /*#__PURE__*/function (_Light) {
86560
86671
  color = _options$color === void 0 ? WHITE : _options$color,
86561
86672
  _options$intensity = options.intensity,
86562
86673
  intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$1 : _options$intensity,
86563
- name = options.name;
86674
+ _options$name = options.name,
86675
+ name = _options$name === void 0 ? "SpotLight_".concat(Math.random()) : _options$name;
86564
86676
  _this = _super.call(this, {
86565
86677
  color: color,
86566
86678
  intensity: intensity,
@@ -86573,6 +86685,10 @@ var SpotLight = /*#__PURE__*/function (_Light) {
86573
86685
  intensity: intensity
86574
86686
  });
86575
86687
 
86688
+ _this.setEntityType(ENTITY_TYPES.LIGHT.SPOT);
86689
+
86690
+ _this.setName(name);
86691
+
86576
86692
  return _this;
86577
86693
  }
86578
86694
 
@@ -86584,7 +86700,10 @@ var SpotLight = /*#__PURE__*/function (_Light) {
86584
86700
  color: 0xeeeeee,
86585
86701
  wireframe: true
86586
86702
  });
86587
- var target = new Element(geometry, material);
86703
+ var target = new Element({
86704
+ geometry: geometry,
86705
+ material: material
86706
+ });
86588
86707
  target.position(initialPosition);
86589
86708
  return target;
86590
86709
  }
@@ -86728,7 +86847,8 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
86728
86847
  } : _options$color,
86729
86848
  _options$intensity = options.intensity,
86730
86849
  intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY : _options$intensity,
86731
- name = options.name;
86850
+ _options$name = options.name,
86851
+ name = _options$name === void 0 ? "HemisphereLight_".concat(Math.random()) : _options$name;
86732
86852
  _this = _super.call(this, {
86733
86853
  color: color,
86734
86854
  intensity: intensity,
@@ -86741,6 +86861,10 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
86741
86861
  intensity: intensity
86742
86862
  });
86743
86863
 
86864
+ _this.setEntityType(ENTITY_TYPES.LIGHT.HEMISPHERE);
86865
+
86866
+ _this.setName(name);
86867
+
86744
86868
  return _this;
86745
86869
  }
86746
86870
 
@@ -88008,7 +88132,7 @@ var Water = /*#__PURE__*/function (_Element) {
88008
88132
 
88009
88133
  _classCallCheck(this, Water);
88010
88134
 
88011
- _this = _super.call(this, null, null, options);
88135
+ _this = _super.call(this, options);
88012
88136
 
88013
88137
  _defineProperty$1(_assertThisInitialized(_this), "update", function (dt) {
88014
88138
  _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Water.prototype)), "update", _thisSuper).call(_thisSuper, dt);
@@ -88158,7 +88282,7 @@ var Sky = /*#__PURE__*/function (_Element) {
88158
88282
 
88159
88283
  _classCallCheck(this, Sky);
88160
88284
 
88161
- _this = _super.call(this, null, null, options);
88285
+ _this = _super.call(this, options);
88162
88286
  var _options$scale = options.scale,
88163
88287
  scale = _options$scale === void 0 ? DEFAULT_SCALE : _options$scale,
88164
88288
  _options$turbidity = options.turbidity,
@@ -88187,7 +88311,7 @@ var Sky = /*#__PURE__*/function (_Element) {
88187
88311
  body: body
88188
88312
  });
88189
88313
 
88190
- _this.setEntityType(ENTITY_TYPES.MESH);
88314
+ _this.setEntityType(ENTITY_TYPES.EFFECT.SCENERY);
88191
88315
 
88192
88316
  _this.setScale({
88193
88317
  x: scale,
@@ -88266,7 +88390,7 @@ var Skybox = /*#__PURE__*/function (_Element) {
88266
88390
  texture = _options$texture === void 0 ? 'skybox' : _options$texture,
88267
88391
  rest = _objectWithoutProperties(options, _excluded);
88268
88392
 
88269
- _this = _super.call(this, null, null, _objectSpread2$1({
88393
+ _this = _super.call(this, _objectSpread2$1({
88270
88394
  name: name,
88271
88395
  texture: texture
88272
88396
  }, rest));