mx3d 0.0.9 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mx3d.js CHANGED
@@ -7,7 +7,7 @@
7
7
  exports["MX3D"] = factory(require("TWEEN"), require("Dazzle"), require("BABYLON"), require("babylonjs-materials"), require("BABYLON.GUI"), require("BABYLON.SceneLoader"), require("babylonjs-serializers"));
8
8
  else
9
9
  root["MX3D"] = factory(root["TWEEN"], root["Dazzle"], root["BABYLON"], root["babylonjs-materials"], root["BABYLON.GUI"], root["BABYLON.SceneLoader"], root["babylonjs-serializers"]);
10
- })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__15__, __WEBPACK_EXTERNAL_MODULE__16__, __WEBPACK_EXTERNAL_MODULE__17__) {
10
+ })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__15__, __WEBPACK_EXTERNAL_MODULE__16__, __WEBPACK_EXTERNAL_MODULE__17__) {
11
11
  return /******/ (function(modules) { // webpackBootstrap
12
12
  /******/ // The module cache
13
13
  /******/ var installedModules = {};
@@ -907,7 +907,7 @@ return /******/ (function(modules) { // webpackBootstrap
907
907
  ;(function (root, factory, undef) {
908
908
  if (true) {
909
909
  // CommonJS
910
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(4));
910
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(5));
911
911
  }
912
912
  else {}
913
913
  }(this, function (CryptoJS) {
@@ -1796,12 +1796,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
1796
1796
 
1797
1797
  /***/ }),
1798
1798
  /* 3 */
1799
+ /***/ (function(module, exports) {
1800
+
1801
+ module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
1802
+
1803
+ /***/ }),
1804
+ /* 4 */
1799
1805
  /***/ (function(module, exports, __webpack_require__) {
1800
1806
 
1801
1807
  ;(function (root, factory, undef) {
1802
1808
  if (true) {
1803
1809
  // CommonJS
1804
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(7), __webpack_require__(20), __webpack_require__(21), __webpack_require__(5), __webpack_require__(22), __webpack_require__(6), __webpack_require__(8), __webpack_require__(10), __webpack_require__(23), __webpack_require__(11), __webpack_require__(24), __webpack_require__(25), __webpack_require__(26), __webpack_require__(9), __webpack_require__(27), __webpack_require__(4), __webpack_require__(1), __webpack_require__(28), __webpack_require__(29), __webpack_require__(30), __webpack_require__(31), __webpack_require__(32), __webpack_require__(33), __webpack_require__(34), __webpack_require__(35), __webpack_require__(36), __webpack_require__(37), __webpack_require__(38), __webpack_require__(39), __webpack_require__(40), __webpack_require__(41), __webpack_require__(42), __webpack_require__(43));
1810
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8), __webpack_require__(20), __webpack_require__(21), __webpack_require__(6), __webpack_require__(22), __webpack_require__(7), __webpack_require__(9), __webpack_require__(11), __webpack_require__(23), __webpack_require__(12), __webpack_require__(24), __webpack_require__(25), __webpack_require__(26), __webpack_require__(10), __webpack_require__(27), __webpack_require__(5), __webpack_require__(1), __webpack_require__(28), __webpack_require__(29), __webpack_require__(30), __webpack_require__(31), __webpack_require__(32), __webpack_require__(33), __webpack_require__(34), __webpack_require__(35), __webpack_require__(36), __webpack_require__(37), __webpack_require__(38), __webpack_require__(39), __webpack_require__(40), __webpack_require__(41), __webpack_require__(42), __webpack_require__(43));
1805
1811
  }
1806
1812
  else {}
1807
1813
  }(this, function (CryptoJS) {
@@ -1811,13 +1817,13 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
1811
1817
  }));
1812
1818
 
1813
1819
  /***/ }),
1814
- /* 4 */
1820
+ /* 5 */
1815
1821
  /***/ (function(module, exports, __webpack_require__) {
1816
1822
 
1817
1823
  ;(function (root, factory, undef) {
1818
1824
  if (true) {
1819
1825
  // CommonJS
1820
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8), __webpack_require__(9));
1826
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(9), __webpack_require__(10));
1821
1827
  }
1822
1828
  else {}
1823
1829
  }(this, function (CryptoJS) {
@@ -1943,7 +1949,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
1943
1949
  }));
1944
1950
 
1945
1951
  /***/ }),
1946
- /* 5 */
1952
+ /* 6 */
1947
1953
  /***/ (function(module, exports, __webpack_require__) {
1948
1954
 
1949
1955
  ;(function (root, factory) {
@@ -2077,7 +2083,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2077
2083
  }));
2078
2084
 
2079
2085
  /***/ }),
2080
- /* 6 */
2086
+ /* 7 */
2081
2087
  /***/ (function(module, exports, __webpack_require__) {
2082
2088
 
2083
2089
  ;(function (root, factory) {
@@ -2343,7 +2349,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2343
2349
  }));
2344
2350
 
2345
2351
  /***/ }),
2346
- /* 7 */
2352
+ /* 8 */
2347
2353
  /***/ (function(module, exports, __webpack_require__) {
2348
2354
 
2349
2355
  ;(function (root, factory) {
@@ -2645,7 +2651,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2645
2651
  }));
2646
2652
 
2647
2653
  /***/ }),
2648
- /* 8 */
2654
+ /* 9 */
2649
2655
  /***/ (function(module, exports, __webpack_require__) {
2650
2656
 
2651
2657
  ;(function (root, factory) {
@@ -2793,7 +2799,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2793
2799
  }));
2794
2800
 
2795
2801
  /***/ }),
2796
- /* 9 */
2802
+ /* 10 */
2797
2803
  /***/ (function(module, exports, __webpack_require__) {
2798
2804
 
2799
2805
  ;(function (root, factory) {
@@ -2934,7 +2940,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2934
2940
  }));
2935
2941
 
2936
2942
  /***/ }),
2937
- /* 10 */
2943
+ /* 11 */
2938
2944
  /***/ (function(module, exports, __webpack_require__) {
2939
2945
 
2940
2946
  ;(function (root, factory) {
@@ -3131,13 +3137,13 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
3131
3137
  }));
3132
3138
 
3133
3139
  /***/ }),
3134
- /* 11 */
3140
+ /* 12 */
3135
3141
  /***/ (function(module, exports, __webpack_require__) {
3136
3142
 
3137
3143
  ;(function (root, factory, undef) {
3138
3144
  if (true) {
3139
3145
  // CommonJS
3140
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(7));
3146
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8));
3141
3147
  }
3142
3148
  else {}
3143
3149
  }(this, function (CryptoJS) {
@@ -3454,12 +3460,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
3454
3460
 
3455
3461
  }));
3456
3462
 
3457
- /***/ }),
3458
- /* 12 */
3459
- /***/ (function(module, exports) {
3460
-
3461
- module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
3462
-
3463
3463
  /***/ }),
3464
3464
  /* 13 */
3465
3465
  /***/ (function(module, exports) {
@@ -3888,7 +3888,7 @@ module.exports = g;
3888
3888
  ;(function (root, factory, undef) {
3889
3889
  if (true) {
3890
3890
  // CommonJS
3891
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(10));
3891
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(11));
3892
3892
  }
3893
3893
  else {}
3894
3894
  }(this, function (CryptoJS) {
@@ -3966,7 +3966,7 @@ module.exports = g;
3966
3966
  ;(function (root, factory, undef) {
3967
3967
  if (true) {
3968
3968
  // CommonJS
3969
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(7), __webpack_require__(11));
3969
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8), __webpack_require__(12));
3970
3970
  }
3971
3971
  else {}
3972
3972
  }(this, function (CryptoJS) {
@@ -4047,7 +4047,7 @@ module.exports = g;
4047
4047
  ;(function (root, factory, undef) {
4048
4048
  if (true) {
4049
4049
  // CommonJS
4050
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(7));
4050
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8));
4051
4051
  }
4052
4052
  else {}
4053
4053
  }(this, function (CryptoJS) {
@@ -4636,7 +4636,7 @@ module.exports = g;
4636
4636
  ;(function (root, factory, undef) {
4637
4637
  if (true) {
4638
4638
  // CommonJS
4639
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8), __webpack_require__(9));
4639
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(9), __webpack_require__(10));
4640
4640
  }
4641
4641
  else {}
4642
4642
  }(this, function (CryptoJS) {
@@ -5381,7 +5381,7 @@ module.exports = g;
5381
5381
  ;(function (root, factory, undef) {
5382
5382
  if (true) {
5383
5383
  // CommonJS
5384
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(5), __webpack_require__(6), __webpack_require__(4), __webpack_require__(1));
5384
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(6), __webpack_require__(7), __webpack_require__(5), __webpack_require__(1));
5385
5385
  }
5386
5386
  else {}
5387
5387
  }(this, function (CryptoJS) {
@@ -5613,7 +5613,7 @@ module.exports = g;
5613
5613
  ;(function (root, factory, undef) {
5614
5614
  if (true) {
5615
5615
  // CommonJS
5616
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(5), __webpack_require__(6), __webpack_require__(4), __webpack_require__(1));
5616
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(6), __webpack_require__(7), __webpack_require__(5), __webpack_require__(1));
5617
5617
  }
5618
5618
  else {}
5619
5619
  }(this, function (CryptoJS) {
@@ -6390,7 +6390,7 @@ module.exports = g;
6390
6390
  ;(function (root, factory, undef) {
6391
6391
  if (true) {
6392
6392
  // CommonJS
6393
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(5), __webpack_require__(6), __webpack_require__(4), __webpack_require__(1));
6393
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(6), __webpack_require__(7), __webpack_require__(5), __webpack_require__(1));
6394
6394
  }
6395
6395
  else {}
6396
6396
  }(this, function (CryptoJS) {
@@ -6527,7 +6527,7 @@ module.exports = g;
6527
6527
  ;(function (root, factory, undef) {
6528
6528
  if (true) {
6529
6529
  // CommonJS
6530
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(5), __webpack_require__(6), __webpack_require__(4), __webpack_require__(1));
6530
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(6), __webpack_require__(7), __webpack_require__(5), __webpack_require__(1));
6531
6531
  }
6532
6532
  else {}
6533
6533
  }(this, function (CryptoJS) {
@@ -6717,7 +6717,7 @@ module.exports = g;
6717
6717
  ;(function (root, factory, undef) {
6718
6718
  if (true) {
6719
6719
  // CommonJS
6720
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(5), __webpack_require__(6), __webpack_require__(4), __webpack_require__(1));
6720
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(6), __webpack_require__(7), __webpack_require__(5), __webpack_require__(1));
6721
6721
  }
6722
6722
  else {}
6723
6723
  }(this, function (CryptoJS) {
@@ -6983,7 +6983,11 @@ class Camera_Camera {
6983
6983
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
6984
6984
  }
6985
6985
  flyTo(_visualAngle, _sheep = 300) {
6986
- this.tw_target.to({ x: _visualAngle.focus.x, y: _visualAngle.focus.y, z: _visualAngle.focus.z }, _sheep).start().onComplete(() => { this.tw_camera.to({ radius: _visualAngle.radius }, _sheep).start(); });
6986
+ this.tw_target.to({ x: _visualAngle.focus.x, y: _visualAngle.focus.y, z: _visualAngle.focus.z }, _sheep).start().onComplete(() => { this.tw_camera.to({ radius: _visualAngle.radius, beta: _visualAngle.beta }, _sheep).start(); });
6987
+ this.camera.lowerRadiusLimit = _visualAngle.minimumLimit;
6988
+ this.camera.upperRadiusLimit = _visualAngle.maximumLimit;
6989
+ this.camera.lowerBetaLimit = _visualAngle.minBeta;
6990
+ this.camera.upperBetaLimit = _visualAngle.maxBeta;
6987
6991
  }
6988
6992
  computeCameraView() {
6989
6993
  const ratio = this.app.canvas.clientWidth / this.app.canvas.clientHeight;
@@ -7045,7 +7049,7 @@ class Dictionary {
7045
7049
  }
7046
7050
  }
7047
7051
 
7048
- // CONCATENATED MODULE: ./src/lib/GUID.ts
7052
+ // CONCATENATED MODULE: ./src/dazzle/GUID.ts
7049
7053
  class GUID {
7050
7054
  static getGUID(length) {
7051
7055
  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
@@ -7163,13 +7167,8 @@ class Spot_Spot extends LightObject {
7163
7167
  }
7164
7168
  }
7165
7169
 
7166
- // CONCATENATED MODULE: ./src/lib/VisualAngle.ts
7167
- class VisualAngle {
7168
- }
7169
-
7170
7170
  // CONCATENATED MODULE: ./src/lib/Tools.ts
7171
-
7172
- class Tools_Tools {
7171
+ class Tools {
7173
7172
  //字符串转为Vector3;
7174
7173
  static vector3ToJson(old) {
7175
7174
  return { x: Math.floor(old.x * 1000) / 1000, y: Math.floor(old.y * 1000) / 1000, z: Math.floor(old.z * 1000) / 1000 };
@@ -7310,12 +7309,12 @@ class Tools_Tools {
7310
7309
  }
7311
7310
  }
7312
7311
  static getVisualAngle(_bound, app) {
7313
- let _visualAngle = new VisualAngle();
7312
+ let _visualAngle = {};
7314
7313
  let radius = _bound.boundingSphere.radiusWorld;
7315
- let aspectRatio = app.engine.getAspectRatio(app.Camera.camera);
7316
- let halfMinFov = app.Camera.camera.fov / 1.2;
7314
+ let aspectRatio = app.engine.getAspectRatio(app.camera.camera);
7315
+ let halfMinFov = app.camera.camera.fov / 1.2;
7317
7316
  if (aspectRatio < 1)
7318
- halfMinFov = Math.atan(aspectRatio * Math.tan(app.Camera.camera.fov / 2));
7317
+ halfMinFov = Math.atan(aspectRatio * Math.tan(app.camera.camera.fov / 2));
7319
7318
  _visualAngle.radius = Math.abs(radius / Math.sin(halfMinFov)) * 1.1;
7320
7319
  _visualAngle.alpha = Math.PI / 2;
7321
7320
  _visualAngle.beta = Math.PI / 4;
@@ -7361,6 +7360,12 @@ class Tools_Tools {
7361
7360
  static getAngleFromVector3(startV, coreV, endV) {
7362
7361
  return this.getAngleFromVector2(new BABYLON.Vector2(startV.x, startV.z), new BABYLON.Vector2(coreV.x, coreV.z), new BABYLON.Vector2(endV.x, endV.z));
7363
7362
  }
7363
+ static RandomNumBoth(Min, Max) {
7364
+ var Range = Max - Min;
7365
+ var Rand = Math.random();
7366
+ var num = Min + Math.round(Rand * Range); //四舍五入
7367
+ return num;
7368
+ }
7364
7369
  }
7365
7370
 
7366
7371
  // CONCATENATED MODULE: ./src/lib/Environment.ts
@@ -7467,7 +7472,7 @@ class Environment_Environment {
7467
7472
  _light.id = _oldLight.id;
7468
7473
  _light.lightType = _oldLight.lightType;
7469
7474
  _light.name = _oldLight.name;
7470
- _light.direction = Tools_Tools.ToVector3(_oldLight.direction);
7475
+ _light.direction = Tools.ToVector3(_oldLight.direction);
7471
7476
  _light.color = _oldLight.color;
7472
7477
  _light.intensity = _oldLight.intensity;
7473
7478
  }
@@ -7476,8 +7481,8 @@ class Environment_Environment {
7476
7481
  _light.id = _oldLight.id;
7477
7482
  _light.lightType = _oldLight.lightType;
7478
7483
  _light.name = _oldLight.name;
7479
- _light.direction = Tools_Tools.ToVector3(_oldLight.direction);
7480
- _light.position = Tools_Tools.ToVector3(_oldLight.position);
7484
+ _light.direction = Tools.ToVector3(_oldLight.direction);
7485
+ _light.position = Tools.ToVector3(_oldLight.position);
7481
7486
  _light.color = _oldLight.color;
7482
7487
  _light.intensity = _oldLight.intensity;
7483
7488
  }
@@ -7486,8 +7491,8 @@ class Environment_Environment {
7486
7491
  _light.id = _oldLight.id;
7487
7492
  _light.lightType = _oldLight.lightType;
7488
7493
  _light.name = _oldLight.name;
7489
- _light.direction = Tools_Tools.ToVector3(_oldLight.direction);
7490
- _light.position = Tools_Tools.ToVector3(_oldLight.position);
7494
+ _light.direction = Tools.ToVector3(_oldLight.direction);
7495
+ _light.position = Tools.ToVector3(_oldLight.position);
7491
7496
  _light.angle = _oldLight.angle;
7492
7497
  _light.exponent = _oldLight.exponent;
7493
7498
  _light.range = _oldLight.range;
@@ -7499,7 +7504,7 @@ class Environment_Environment {
7499
7504
  _light.id = _oldLight.id;
7500
7505
  _light.lightType = _oldLight.lightType;
7501
7506
  _light.name = _oldLight.name;
7502
- _light.position = Tools_Tools.ToVector3(_oldLight.position);
7507
+ _light.position = Tools.ToVector3(_oldLight.position);
7503
7508
  _light.range = _oldLight.range;
7504
7509
  _light.color = _oldLight.color;
7505
7510
  _light.intensity = _oldLight.intensity;
@@ -7541,7 +7546,7 @@ class ReadJSON {
7541
7546
  }
7542
7547
 
7543
7548
  // EXTERNAL MODULE: ./node_modules/crypto-js/index.js
7544
- var crypto_js = __webpack_require__(3);
7549
+ var crypto_js = __webpack_require__(4);
7545
7550
  var crypto_js_default = /*#__PURE__*/__webpack_require__.n(crypto_js);
7546
7551
 
7547
7552
  // CONCATENATED MODULE: ./src/lib/Cryptojs.ts
@@ -7564,7 +7569,7 @@ class EffectMgr_EffectMgr {
7564
7569
  5: BABYLON.Color3.Green()
7565
7570
  };
7566
7571
  let tyiji = new external_TWEEN_default.a.Tween(this.colors[1]).to({ r: 1, g: 0, b: 0 }, 500);
7567
- let tyiji1 = new external_TWEEN_default.a.Tween(this.colors[1]).to({ r: 0.2, g: 0, b: 0 }, 500);
7572
+ let tyiji1 = new external_TWEEN_default.a.Tween(this.colors[1]).to({ r: 1, g: 0.5, b: 0.5 }, 500);
7568
7573
  tyiji1.chain(tyiji);
7569
7574
  tyiji.chain(tyiji1);
7570
7575
  tyiji.start();
@@ -7782,8 +7787,10 @@ class Project_Project {
7782
7787
  delete() {
7783
7788
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
7784
7789
  for (const _o in this.objectDatas.map) {
7785
- this.objectDatas.find(_o).instance.dispose();
7790
+ if (this.objectDatas.find(_o).instance)
7791
+ this.objectDatas.find(_o).instance.dispose();
7786
7792
  }
7793
+ this.objectDatas.clear();
7787
7794
  this.current = null;
7788
7795
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
7789
7796
  }
@@ -7791,12 +7798,10 @@ class Project_Project {
7791
7798
  //冻结活动网格,与自发光合用回导致内存泄露
7792
7799
  this.app.scene.freezeActiveMeshes();
7793
7800
  }
7794
- getTreeData() {
7795
- }
7796
- getChildNode(_id) {
7801
+ getChildNodes(_id) {
7797
7802
  let _objects = new Array();
7798
7803
  for (const id in this.objectDatas.map) {
7799
- let _object = this.app.Project.objectDatas.find(id);
7804
+ let _object = this.app.project.objectDatas.find(id);
7800
7805
  if (_object.parentId == _id && _object.objectType != ObjectType.Wall && _object.objectType != ObjectType.Corner)
7801
7806
  _objects.push(_object);
7802
7807
  }
@@ -7805,10 +7810,20 @@ class Project_Project {
7805
7810
  find(_id) {
7806
7811
  return this.objectDatas.find(_id);
7807
7812
  }
7813
+ findFormObjectType(_type, isCurent = true) {
7814
+ let _objects = new Array();
7815
+ for (const id in this.objectDatas.map) {
7816
+ let _object = this.app.project.objectDatas.find(id);
7817
+ if ((isCurent && _object.parentId != this.current.id) || _object.objectType != _type)
7818
+ continue;
7819
+ _objects.push(_object);
7820
+ }
7821
+ return _objects;
7822
+ }
7808
7823
  show() {
7809
7824
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
7810
- for (const id in this.app.Project.objectDatas.map) {
7811
- let _object = this.app.Project.objectDatas.find(id);
7825
+ for (const id in this.app.project.objectDatas.map) {
7826
+ let _object = this.app.project.objectDatas.find(id);
7812
7827
  _object.setEnabled(true);
7813
7828
  }
7814
7829
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
@@ -7844,6 +7859,7 @@ class Resources_Resources {
7844
7859
  this.transparentBox.visibility = 0.3;
7845
7860
  let boxId = GUID.getGUID(12);
7846
7861
  this.BOX = BABYLON.MeshBuilder.CreateBox(boxId, { size: 1 }, this.app.scene);
7862
+ this.BOX.edgesColor = BABYLON.Color4.FromHexString("#4ba3fff2");
7847
7863
  // this.BOX.registerInstancedBuffer("color", 4);
7848
7864
  // this.BOX.instancedBuffers.color = new BABYLON.Color4(1, 0, 0, 1);
7849
7865
  this.BOX.setEnabled(false);
@@ -7867,10 +7883,14 @@ class Resources_Resources {
7867
7883
  _mesh.animationGroups[0].stop();
7868
7884
  _mesh.addAllToScene();
7869
7885
  _mesh.meshes[0].setEnabled(false);
7870
- _mesh.meshes[0].getChildMeshes().forEach(e => {
7871
- // if (e.material) e.material.freeze();
7872
- if (e.metadata && e.metadata.gltf && e.metadata.gltf.extras && (e.metadata.gltf.extras.U || e.metadata.gltf.extras.V))
7886
+ _mesh.meshes[0].getChildMeshes().forEach(m => {
7887
+ if (m.metadata && m.metadata.gltf && m.metadata.gltf.extras) {
7873
7888
  _mesh.isExtras = true;
7889
+ if (m.metadata.gltf.extras.U)
7890
+ BABYLON.Animation.CreateAndStartAnimation("u", m.material.albedoTexture, "uOffset", m.metadata.gltf.extras.Uspeed * 30, 30, 0, 1, 1);
7891
+ if (m.metadata.gltf.extras.V)
7892
+ BABYLON.Animation.CreateAndStartAnimation("v", m.material.albedoTexture, "vOffset", m.metadata.gltf.extras.Vspeed * 30, 30, 0, 1, 1);
7893
+ }
7874
7894
  });
7875
7895
  if (baseModel.objectType != ObjectType.OutDoorScene && !_mesh.isExtras) {
7876
7896
  _mesh.meshes[0].getChildMeshes().forEach(e => {
@@ -7892,10 +7912,10 @@ class Resources_Resources {
7892
7912
  BABYLON.SceneLoader.LoadAssetContainerAsync(this.resourcePath + "Bundle/" + baseModel.modelId + "/", baseModel.modelId + baseModel.extension, this.app.scene).then((container) => {
7893
7913
  if (container.animationGroups.length > 0)
7894
7914
  container.animationGroups[0].stop();
7895
- container.meshes[0].getChildMeshes().forEach(e => {
7896
- e.registerInstancedBuffer("color", 4);
7897
- e.instancedBuffers.color = new BABYLON.Color4(1, 1, 1, 1);
7898
- });
7915
+ // container.meshes[0].getChildMeshes().forEach(e => {
7916
+ // (e as BABYLON.Mesh).registerInstancedBuffer("color", 4);
7917
+ // e.instancedBuffers.color = new BABYLON.Color4(1, 1, 1, 1);
7918
+ // });
7899
7919
  this.resources.add(baseModel.modelId, container);
7900
7920
  callback(container);
7901
7921
  }).catch(() => {
@@ -8031,6 +8051,55 @@ var EventType;
8031
8051
  EventType["out"] = "out";
8032
8052
  })(EventType || (EventType = {}));
8033
8053
 
8054
+ // CONCATENATED MODULE: ./src/lib/VisualAngle.ts
8055
+
8056
+
8057
+ class VisualAngle_VisualAngle {
8058
+ constructor(_object) {
8059
+ this.object = _object;
8060
+ //重新计算包围盒
8061
+ if (this.object instanceof Region_Region) {
8062
+ let bound = this.object.getBounding();
8063
+ let _vis = src.Tools.getVisualAngle(bound, this.object.app);
8064
+ this.alpha = _vis.alpha;
8065
+ this.beta = _vis.beta;
8066
+ this.focus = _vis.focus;
8067
+ this.radius = bound.boundingSphere.radiusWorld + 3;
8068
+ this.focus.y = this.object.height;
8069
+ }
8070
+ else {
8071
+ let bound = this.object.instance.getBoundingInfo();
8072
+ let _vis = src.Tools.getVisualAngle(bound, this.object.app);
8073
+ this.alpha = _vis.alpha;
8074
+ this.beta = _vis.beta;
8075
+ this.focus = this.object.instance.getAbsolutePosition();
8076
+ this.radius = bound.boundingSphere.radiusWorld + 3;
8077
+ }
8078
+ this.minimumLimit = 0.3;
8079
+ this.maximumLimit = this.radius * 2;
8080
+ this.minBeta = 0.01;
8081
+ this.maxBeta = (Math.PI / 2) * 0.98;
8082
+ }
8083
+ //设置视角参数
8084
+ setVisual(_visual) {
8085
+ let config = JSON.parse(_visual);
8086
+ this.alpha = config.alpha;
8087
+ this.beta = config.beta;
8088
+ this.radius = config.radius;
8089
+ this.focus = src.Tools.ToVector3(config.focus);
8090
+ }
8091
+ //设置缩放范围
8092
+ setLimit(_miniLimit, _maxiLimit) {
8093
+ this.minimumLimit = _miniLimit + 0.3;
8094
+ this.maximumLimit = _maxiLimit;
8095
+ }
8096
+ //设置上下视角限制
8097
+ setBeta(_minBeta, _maxBeta) {
8098
+ this.minBeta = _minBeta;
8099
+ this.maxBeta = _maxBeta;
8100
+ }
8101
+ }
8102
+
8034
8103
  // CONCATENATED MODULE: ./src/lib/EffectType.ts
8035
8104
  var EffectType;
8036
8105
  (function (EffectType) {
@@ -8044,6 +8113,7 @@ var EffectType;
8044
8113
 
8045
8114
 
8046
8115
 
8116
+
8047
8117
  class DefaultObject_DefaultObject {
8048
8118
  constructor(_app) {
8049
8119
  this.isVisible = true;
@@ -8054,8 +8124,6 @@ class DefaultObject_DefaultObject {
8054
8124
  this._isMonitor = true;
8055
8125
  this.app = _app;
8056
8126
  }
8057
- ;
8058
- ;
8059
8127
  set isMonitor(_value) {
8060
8128
  this._isMonitor = _value;
8061
8129
  }
@@ -8084,22 +8152,16 @@ class DefaultObject_DefaultObject {
8084
8152
  get showBoundingBox() {
8085
8153
  return this.instance.showBoundingBox;
8086
8154
  }
8087
- setVisualAngle(_visualAngle, _miniLimit = 1, _maxiLimit = 3000) {
8088
- let config = JSON.parse(_visualAngle);
8089
- this.visualAngle.alpha = config.alpha;
8090
- this.visualAngle.beta = config.beta;
8091
- this.visualAngle.radius = config.radius;
8092
- this.visualAngle.focus = src.Tools.ToVector3(config.focus);
8093
- this.visualAngle.minimumLimit = _miniLimit;
8094
- this.visualAngle.maximumLimit = _maxiLimit;
8095
- }
8096
8155
  bind(_m) {
8097
8156
  this.id = _m.id;
8098
8157
  this.name = _m.name;
8099
8158
  this.parentId = _m.parentId;
8100
8159
  this.modelId = _m.baseModel.modelId;
8160
+ this.animation = _m.animation;
8161
+ this.isAutoPlay = _m.isAutoPlay;
8162
+ this.isloop = _m.isloop;
8101
8163
  this.isMonitor = _m.isMonitor;
8102
- if (_m.isVisible)
8164
+ if (_m.isVisible != null)
8103
8165
  this.isVisible = _m.isVisible;
8104
8166
  this.objectType = _m.objectType;
8105
8167
  let _o = new BABYLON.Mesh(this.id, this.app.scene);
@@ -8126,27 +8188,19 @@ class DefaultObject_DefaultObject {
8126
8188
  this.instance.position.y = (bound.maximum.y - bound.minimum.y) / 2 + _o.position.y;
8127
8189
  this.instance.rotation = _o.rotation.clone();
8128
8190
  _o.setParent(this.instance);
8129
- this.instance.setBoundingInfo(bound);
8130
- // this.instance.getChildMeshes().forEach(e => e.setParent(box));
8131
8191
  this.alwaysActive();
8132
8192
  this.optimization(true);
8133
8193
  this.instance.setEnabled(false);
8134
- this.restVisualAngle();
8194
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8195
+ if (this.isAutoPlay)
8196
+ this.play();
8135
8197
  // this.addEventListener(EventType.doubleClick, (x) => {
8136
8198
  // console.log(x)
8137
8199
  // x.play(true);
8138
- // x.color = { r: 1, g: 0, b: 0 }
8139
8200
  // });
8140
8201
  // this.play(true);
8141
8202
  // this.alwaysSelect();
8142
8203
  }
8143
- restVisualAngle() {
8144
- //重新计算包围盒
8145
- let bound = this.instance.getBoundingInfo();
8146
- this.visualAngle = src.Tools.getVisualAngle(this.instance.getBoundingInfo(), this.app);
8147
- this.visualAngle.focus = this.instance.getAbsolutePosition();
8148
- this.visualAngle.radius = bound.boundingSphere.radiusWorld + 3;
8149
- }
8150
8204
  //true:优化,false:取消优化
8151
8205
  optimization(_isOptimization) {
8152
8206
  this.instance.getChildMeshes().forEach(x => {
@@ -8229,19 +8283,55 @@ class DefaultObject_DefaultObject {
8229
8283
  }
8230
8284
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8231
8285
  }
8232
- setFlash(_level) { }
8233
- setOpaque() { }
8234
- setTransparent() { }
8235
- play(isloop = false) {
8286
+ //设置告警闪烁
8287
+ setFlash(_level) {
8288
+ if (this.effectType != EffectType.Opaque)
8289
+ return;
8290
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8291
+ this.instance.getChildMeshes().forEach(e => {
8292
+ if (e.instancedBuffers)
8293
+ e.instancedBuffers.color = src.EffectMgr.colors[_level];
8294
+ });
8295
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8296
+ this.effectType = EffectType.Flash;
8297
+ }
8298
+ //设置正常
8299
+ setOpaque() {
8300
+ if (this.effectType == EffectType.Opaque)
8301
+ return;
8302
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8303
+ this.instance.getChildMeshes().forEach(e => {
8304
+ e.setEnabled(true);
8305
+ if (e.instancedBuffers)
8306
+ e.instancedBuffers.color = new BABYLON.Color4(1, 1, 1, 1);
8307
+ });
8308
+ this.instance.disableEdgesRendering();
8309
+ this.instance.visibility = 0;
8310
+ this.setEnabled(this.isEnabled);
8311
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8312
+ this.effectType = EffectType.Opaque;
8313
+ }
8314
+ //设置半透明
8315
+ setTransparent(alpha = 0.3) {
8316
+ if (this.effectType != EffectType.Opaque)
8317
+ return;
8318
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8319
+ this.instance.getChildMeshes().forEach(e => e.setEnabled(false));
8320
+ this.instance.visibility = alpha;
8321
+ this.instance.enableEdgesRendering();
8322
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8323
+ this.effectType = EffectType.Transparent;
8324
+ }
8325
+ play() {
8236
8326
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8237
8327
  this.instance.getChildMeshes().forEach(m => {
8238
8328
  let open;
8239
8329
  m.animations.forEach((e) => { if (e.name.indexOf("open") != -1)
8240
8330
  open = e; });
8241
8331
  if (open)
8242
- this.app.scene.beginDirectAnimation(m, [open], 0, open.getKeys().length * 10, isloop);
8332
+ this.app.scene.beginDirectAnimation(m, [open], 0, open.getKeys().length * 10, this.isloop);
8243
8333
  else
8244
- m.animations.forEach((e) => this.app.scene.beginDirectAnimation(m, [e], 0, e.getKeys().length * 10, isloop));
8334
+ m.animations.forEach((e) => this.app.scene.beginDirectAnimation(m, [e], 0, e.getKeys().length * 10, this.isloop));
8245
8335
  });
8246
8336
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8247
8337
  }
@@ -8259,7 +8349,7 @@ class DefaultObject_DefaultObject {
8259
8349
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8260
8350
  }
8261
8351
  flyTo() {
8262
- this.app.Camera.flyTo(this.visualAngle, 500);
8352
+ this.app.camera.flyTo(this.visualAngle, 500);
8263
8353
  }
8264
8354
  focus() {
8265
8355
  // this.app.Camera.focusingFromProperty(this.visualAngle);
@@ -8307,6 +8397,7 @@ class WallObject_WallObject extends DefaultObject_DefaultObject {
8307
8397
  // CONCATENATED MODULE: ./src/lib/components/WindowObject.ts
8308
8398
 
8309
8399
 
8400
+
8310
8401
  //窗户
8311
8402
  class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8312
8403
  // virtualBox: BABYLON.InstancedMesh;
@@ -8347,7 +8438,7 @@ class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8347
8438
  this.instance = new BABYLON.Mesh(this.id, this.app.scene);
8348
8439
  let res = this.app.Resources.resources.find(this.modelId);
8349
8440
  res.meshes[0].getChildMeshes().forEach(x => {
8350
- var m = x.createInstance(this.id);
8441
+ var m = this.app.highQualityMode ? x.clone(this.id) : x.createInstance(this.id);
8351
8442
  m.parent = this.instance;
8352
8443
  });
8353
8444
  let bound = src.Tools.computeBounds(this.instance);
@@ -8368,7 +8459,7 @@ class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8368
8459
  this.alwaysActive();
8369
8460
  this.optimization(true);
8370
8461
  this.instance.setEnabled(false);
8371
- this.restVisualAngle();
8462
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8372
8463
  //重新计算包围盒
8373
8464
  // this.bound = this.instance.getBoundingInfo();
8374
8465
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8381,6 +8472,7 @@ class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8381
8472
  // CONCATENATED MODULE: ./src/lib/components/DoorObject.ts
8382
8473
 
8383
8474
 
8475
+
8384
8476
  //门
8385
8477
  class DoorObject_DoorObject extends DefaultObject_DefaultObject {
8386
8478
  bind(_m) {
@@ -8394,7 +8486,7 @@ class DoorObject_DoorObject extends DefaultObject_DefaultObject {
8394
8486
  this.instance = new BABYLON.Mesh(this.id, this.app.scene);
8395
8487
  let res = this.app.Resources.resources.find(this.modelId);
8396
8488
  res.meshes[0].getChildMeshes().forEach(x => {
8397
- var m = x.createInstance(this.id);
8489
+ var m = this.app.highQualityMode ? x.clone(this.id) : x.createInstance(this.id);
8398
8490
  m.parent = this.instance;
8399
8491
  });
8400
8492
  let bound = src.Tools.computeBounds(this.instance);
@@ -8415,7 +8507,7 @@ class DoorObject_DoorObject extends DefaultObject_DefaultObject {
8415
8507
  this.alwaysActive();
8416
8508
  this.optimization(true);
8417
8509
  this.instance.setEnabled(false);
8418
- this.restVisualAngle();
8510
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8419
8511
  }
8420
8512
  }
8421
8513
 
@@ -8429,27 +8521,9 @@ class CabinetObject_CabinetObject extends DefaultObject_DefaultObject {
8429
8521
 
8430
8522
 
8431
8523
 
8524
+
8432
8525
  //漏水线
8433
8526
  class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8434
- // set transparent(_value: boolean) {
8435
- // if (this._transparent == _value) return;
8436
- // this._transparent = _value;
8437
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8438
- // if (this._transparent) this.instance.getChildMeshes().forEach(x => x.visibility = 0.2);
8439
- // else this.instance.getChildMeshes().forEach(x => x.visibility = 1);
8440
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8441
- // }
8442
- // constructor(_app: App) {
8443
- // super();
8444
- // this.app = _app;
8445
- // }
8446
- // set color(_value: { r: number, g: number, b: number }) {
8447
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8448
- // this.instance.getChildMeshes().forEach(e => {
8449
- // e.instancedBuffers.color = new BABYLON.Color4(_value.r, _value.g, _value.b, 1);
8450
- // })
8451
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8452
- // }
8453
8527
  bind(_l) {
8454
8528
  let lines = src.Tools.ToARRVector3(_l.lines);
8455
8529
  this.instance = src.Tools.createTube(_l.id, lines, 0.02, this.app);
@@ -8462,12 +8536,11 @@ class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8462
8536
  this.isMonitor = _l.isMonitor;
8463
8537
  var material0 = this.app.Resources.GetMaterial(_l.baseModel, this.app.scene).clone(this.id);
8464
8538
  BABYLON.Animation.CreateAndStartAnimation("u", material0.diffuseTexture, "vOffset", 15, 30, 0, 1, 1);
8465
- if (_l.baseModel.isTiling)
8466
- material0.diffuseTexture.vScale = this.instance.getTotalVertices() / 200;
8539
+ material0.diffuseTexture.vScale = this.instance.getTotalVertices() / 50;
8467
8540
  this.instance.material = material0;
8468
8541
  this.alwaysActive();
8469
8542
  this.optimization(true);
8470
- this.restVisualAngle();
8543
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8471
8544
  // let bound = this.instance.getBoundingInfo();
8472
8545
  // this.instance.position = this.bound.boundingBox.center.clone();
8473
8546
  // this.visualAngle = MX3D.Tools.getVisualAngle(bound);
@@ -8543,6 +8616,7 @@ class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8543
8616
  // CONCATENATED MODULE: ./src/lib/components/VirtualBoxObject.ts
8544
8617
 
8545
8618
 
8619
+
8546
8620
  //虚拟盒子
8547
8621
  class VirtualBoxObject_VirtualBoxObject extends DefaultObject_DefaultObject {
8548
8622
  async bind(_m) {
@@ -8592,7 +8666,7 @@ class VirtualBoxObject_VirtualBoxObject extends DefaultObject_DefaultObject {
8592
8666
  this.instance.scaling = src.Tools.ToVector3(_m.scaling);
8593
8667
  this.alwaysActive();
8594
8668
  this.optimization(true);
8595
- this.restVisualAngle();
8669
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8596
8670
  //重新计算包围盒
8597
8671
  // this.bound = this.instance.getBoundingInfo();
8598
8672
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8605,6 +8679,7 @@ class VirtualBoxObject_VirtualBoxObject extends DefaultObject_DefaultObject {
8605
8679
  // CONCATENATED MODULE: ./src/lib/components/UI3DTextObject.ts
8606
8680
 
8607
8681
 
8682
+
8608
8683
  //3d文本
8609
8684
  class UI3DTextObject_UI3DTextObject extends DefaultObject_DefaultObject {
8610
8685
  // set transparent(_value: boolean) {
@@ -8662,7 +8737,7 @@ class UI3DTextObject_UI3DTextObject extends DefaultObject_DefaultObject {
8662
8737
  this.instance.material = mat;
8663
8738
  this.alwaysActive();
8664
8739
  this.optimization(true);
8665
- this.restVisualAngle();
8740
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8666
8741
  //重新计算包围盒
8667
8742
  // this.bound = this.instance.getBoundingInfo();
8668
8743
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8673,6 +8748,8 @@ class UI3DTextObject_UI3DTextObject extends DefaultObject_DefaultObject {
8673
8748
  }
8674
8749
 
8675
8750
  // CONCATENATED MODULE: ./src/lib/components/ConduitObject.ts
8751
+ // import MX3D from "../../index";
8752
+
8676
8753
 
8677
8754
 
8678
8755
  //墙角
@@ -8684,8 +8761,8 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
8684
8761
  this.isMonitor = _m.isMonitor;
8685
8762
  this.objectType = _m.objectType;
8686
8763
  this.isVisible = true;
8687
- let pists = src.Tools.ToARRVector3(_m.pints);
8688
- this.instance = src.Tools.createTube(_m.id, pists, _m.radius, this.app);
8764
+ let pists = Tools.ToARRVector3(_m.pints);
8765
+ this.instance = Tools.createTube(_m.id, pists, _m.radius, this.app);
8689
8766
  let mat = new BABYLON.StandardMaterial(_m.id, this.app.scene);
8690
8767
  mat.diffuseColor = BABYLON.Color3.FromHexString(_m.color);
8691
8768
  mat.alpha = _m.alpha;
@@ -8695,7 +8772,7 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
8695
8772
  this.instance.setEnabled(false);
8696
8773
  this.alwaysActive();
8697
8774
  this.optimization(true);
8698
- this.restVisualAngle();
8775
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8699
8776
  //重新计算包围盒
8700
8777
  // this.bound = this.instance.getBoundingInfo();
8701
8778
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8707,6 +8784,7 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
8707
8784
  // CONCATENATED MODULE: ./src/lib/components/FloorObject.ts
8708
8785
 
8709
8786
 
8787
+
8710
8788
  //房间
8711
8789
  class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8712
8790
  bind(_m) {
@@ -8716,7 +8794,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8716
8794
  this.modelId = _m.baseModel.modelId;
8717
8795
  this.objectType = _m.objectType;
8718
8796
  this.isMonitor = true;
8719
- this.instance = BABYLON.MeshBuilder.CreatePolygon("地板", { shape: src.Tools.Expand(_m.vectors, -0.01), holes: _m.buckles, sideOrientation: BABYLON.Mesh.DOUBLESIDE }, this.app.scene);
8797
+ this.instance = BABYLON.MeshBuilder.CreatePolygon("地板", { shape: Tools.Expand(_m.vectors, -0.01), holes: _m.buckles, sideOrientation: BABYLON.Mesh.DOUBLESIDE }, this.app.scene);
8720
8798
  this.alwaysActive();
8721
8799
  this.instance.setEnabled(false);
8722
8800
  this.instance.isPickable = false;
@@ -8727,7 +8805,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8727
8805
  this.instance.name = "地板";
8728
8806
  var material0 = this.app.Resources.GetMaterial(_m.baseModel, this.app.scene).clone(_m.id);
8729
8807
  let bound = this.instance.getBoundingInfo();
8730
- this.visualAngle = src.Tools.getVisualAngle(bound, this.app);
8808
+ this.visualAngle = Tools.getVisualAngle(bound, this.app);
8731
8809
  // let zz = this.bound.boundingBox.center;
8732
8810
  // this.instance.setPivotMatrix(BABYLON.Matrix.Translation(0, 0, 0), false);
8733
8811
  if (_m.baseModel.isTiling) {
@@ -8736,7 +8814,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8736
8814
  }
8737
8815
  this.instance.material = material0;
8738
8816
  this.optimization(true);
8739
- this.restVisualAngle();
8817
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8740
8818
  // this.nativeMaterial = material0;
8741
8819
  // this.material = this.nativeMaterial;
8742
8820
  // this.alwaysSelect();
@@ -8749,6 +8827,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8749
8827
 
8750
8828
  // CONCATENATED MODULE: ./src/lib/components/OptimizedWallObject.ts
8751
8829
 
8830
+
8752
8831
  //墙体
8753
8832
  class OptimizedWallObject_OptimizedWallObject extends DefaultObject_DefaultObject {
8754
8833
  // set transparent(_value: boolean) {
@@ -8806,12 +8885,13 @@ class OptimizedWallObject_OptimizedWallObject extends DefaultObject_DefaultObjec
8806
8885
  this.alwaysActive();
8807
8886
  this.optimization(true);
8808
8887
  this.instance.setEnabled(false);
8809
- this.restVisualAngle();
8888
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8810
8889
  }
8811
8890
  }
8812
8891
  }
8813
8892
 
8814
8893
  // CONCATENATED MODULE: ./src/lib/components/CornerObject.ts
8894
+ // import MX3D from "../../index";
8815
8895
 
8816
8896
 
8817
8897
 
@@ -8837,7 +8917,7 @@ class CornerObject_CornerObject extends DefaultObject_DefaultObject {
8837
8917
  if (meshs.length < 1)
8838
8918
  return result;
8839
8919
  if (meshs.length > 1)
8840
- this.instance = src.Tools.MergeMeshes(meshs, this.app);
8920
+ this.instance = Tools.MergeMeshes(meshs, this.app);
8841
8921
  else
8842
8922
  this.instance = meshs[0];
8843
8923
  this.instance.id = this.id;
@@ -8862,14 +8942,14 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8862
8942
  focus() {
8863
8943
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8864
8944
  let childs = new Array();
8865
- for (const id in this.app.Project.objectDatas.map) {
8866
- let _object = this.app.Project.objectDatas.find(id);
8945
+ for (const id in this.app.project.objectDatas.map) {
8946
+ let _object = this.app.project.objectDatas.find(id);
8867
8947
  if (_object.parentId == this.id)
8868
8948
  childs.push(_object);
8869
8949
  _object.setEnabled(false);
8870
8950
  }
8871
- for (const id in this.app.Project.objectDatas.map) {
8872
- let _object = this.app.Project.objectDatas.find(id);
8951
+ for (const id in this.app.project.objectDatas.map) {
8952
+ let _object = this.app.project.objectDatas.find(id);
8873
8953
  if (_object.objectType != ObjectType.Wall
8874
8954
  && _object.objectType != ObjectType.Corner
8875
8955
  && _object.objectType != ObjectType.Floor
@@ -8885,7 +8965,73 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8885
8965
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8886
8966
  }
8887
8967
  restVisualAngle() {
8888
- this.visualAngle = Tools_Tools.getVisualAngle(this.instance.getBoundingInfo(), this.app);
8968
+ this.visualAngle = Tools.getVisualAngle(this.instance.getBoundingInfo(), this.app);
8969
+ }
8970
+ }
8971
+
8972
+ // CONCATENATED MODULE: ./src/lib/components/AirFlowObject.ts
8973
+
8974
+
8975
+
8976
+ //气流模拟
8977
+ class AirFlowObject_AirFlowObject extends DefaultObject_DefaultObject {
8978
+ bind(_m) {
8979
+ this.id = _m.id;
8980
+ this.name = _m.name;
8981
+ this.parentId = _m.parentId;
8982
+ this.modelId = _m.baseModel.modelId;
8983
+ this.animation = true;
8984
+ this.isAutoPlay = true;
8985
+ this.isloop = true;
8986
+ this.isVisible = false;
8987
+ this.isMonitor = _m.isMonitor;
8988
+ if (_m.isVisible != null)
8989
+ this.isVisible = _m.isVisible;
8990
+ this.objectType = _m.objectType;
8991
+ let _o = new BABYLON.Mesh(this.id, this.app.scene);
8992
+ let res = this.app.Resources.resources.find(this.modelId);
8993
+ res.meshes[0].getChildMeshes().forEach(x => {
8994
+ var m = x.createInstance(this.id);
8995
+ m.isPickable = false;
8996
+ m.enablePointerMoveEvents = false;
8997
+ m.parent = _o;
8998
+ });
8999
+ _o.rotation = src.Tools.ToVector3(_m.rotation);
9000
+ _o.position = src.Tools.ToVector3(_m.position);
9001
+ _o.scaling = src.Tools.ToVector3(_m.scaling);
9002
+ let bound = src.Tools.computeBounds(_o);
9003
+ _o.setBoundingInfo(bound);
9004
+ this.instance = _o;
9005
+ this.alwaysActive();
9006
+ this.optimization(true);
9007
+ this.instance.setEnabled(false);
9008
+ this.visualAngle = new VisualAngle_VisualAngle(this);
9009
+ if (this.isAutoPlay)
9010
+ this.play();
9011
+ }
9012
+ setFlash(_level) {
9013
+ }
9014
+ setTransparent(_alpha) {
9015
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9016
+ this.setEnabled(false);
9017
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9018
+ }
9019
+ setOpaque() {
9020
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9021
+ this.setEnabled(true);
9022
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9023
+ }
9024
+ play() {
9025
+ // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9026
+ // this.instance.getChildMeshes().forEach(m => {
9027
+ // if (m.metadata && m.metadata.gltf && m.metadata.gltf.extras) {
9028
+ // if (m.metadata.gltf.extras.U) BABYLON.Animation.CreateAndStartAnimation("u", (m.material as any).albedoTexture, "uOffset", m.metadata.gltf.extras.Uspeed * 30, 30, 0, 1, 1);
9029
+ // if (m.metadata.gltf.extras.V) BABYLON.Animation.CreateAndStartAnimation("v", (m.material as any).albedoTexture, "vOffset", m.metadata.gltf.extras.Vspeed * 30, 30, 0, 1, 1);
9030
+ // }
9031
+ // });
9032
+ // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9033
+ }
9034
+ stop() {
8889
9035
  }
8890
9036
  }
8891
9037
 
@@ -8907,6 +9053,7 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8907
9053
 
8908
9054
 
8909
9055
 
9056
+
8910
9057
  class Region_Region extends DefaultObject_DefaultObject {
8911
9058
  constructor(app, _storey) {
8912
9059
  super(app);
@@ -8931,7 +9078,7 @@ class Region_Region extends DefaultObject_DefaultObject {
8931
9078
  let _wall = new OptimizedWallObject_OptimizedWallObject(this.app);
8932
9079
  _wall.bind(_nw);
8933
9080
  if (_wall.instance)
8934
- this.app.Project.objectDatas.add(_wall.id, _wall);
9081
+ this.app.project.objectDatas.add(_wall.id, _wall);
8935
9082
  }
8936
9083
  let walls = new Array();
8937
9084
  for (let i = 0; i < _storey.length; i++) {
@@ -8974,7 +9121,7 @@ class Region_Region extends DefaultObject_DefaultObject {
8974
9121
  let result = _corner.bind(corners);
8975
9122
  if (result) {
8976
9123
  _corner.parentId = this.id;
8977
- this.app.Project.objectDatas.add(_corner.id, _corner);
9124
+ this.app.project.objectDatas.add(_corner.id, _corner);
8978
9125
  }
8979
9126
  else
8980
9127
  _corner = null;
@@ -9017,7 +9164,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9017
9164
  let _object = new FloorObject_FloorObject(this.app);
9018
9165
  _object.height = this.height;
9019
9166
  _object.bind(_floor);
9020
- this.app.Project.objectDatas.add(_object.id, _object);
9167
+ this.app.project.objectDatas.add(_object.id, _object);
9021
9168
  }
9022
9169
  dicVector = null;
9023
9170
  //灯光
@@ -9048,10 +9195,12 @@ class Region_Region extends DefaultObject_DefaultObject {
9048
9195
  continue;
9049
9196
  else if (_m.objectType == ObjectType.Floor)
9050
9197
  continue;
9198
+ else if (_m.objectType == ObjectType.AirFlow)
9199
+ _object = new AirFlowObject_AirFlowObject(this.app);
9051
9200
  else
9052
9201
  _object = new DefaultObject_DefaultObject(this.app);
9053
9202
  _object.bind(_m);
9054
- this.app.Project.objectDatas.add(_object.id, _object);
9203
+ this.app.project.objectDatas.add(_object.id, _object);
9055
9204
  }
9056
9205
  //创建未优化的墙
9057
9206
  if (!isOptimized) {
@@ -9069,7 +9218,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9069
9218
  _obejct.subMeshes.push(new BABYLON.SubMesh(0, 2, verticesCount, 30, 6, _obejct)); //2
9070
9219
  for (let w = 0; w < walls[i].wallwindows.length; w++) {
9071
9220
  const ames1 = BABYLON.CSG.FromMesh(_obejct);
9072
- let _win = this.app.Project.objectDatas.find(walls[i].wallwindows[w]);
9221
+ let _win = this.app.project.objectDatas.find(walls[i].wallwindows[w]);
9073
9222
  var bout = _win.instance.getBoundingInfo();
9074
9223
  var box = BABYLON.MeshBuilder.CreateBox(new Date().getTime().toString(), { height: bout.maximum.y - bout.minimum.y, width: bout.maximum.x - bout.minimum.x, depth: parseFloat(walls[i].ply) * 2 + 0.1 }, this.app.scene);
9075
9224
  box.position = _win.instance.position.clone();
@@ -9112,31 +9261,32 @@ class Region_Region extends DefaultObject_DefaultObject {
9112
9261
  _wall.parentId = this.id;
9113
9262
  _wall.height = this.height;
9114
9263
  _wall.bind(beforeWalls.find(key));
9115
- this.app.Project.objectDatas.add(_wall.id, _wall);
9264
+ this.app.project.objectDatas.add(_wall.id, _wall);
9116
9265
  }
9117
9266
  }
9118
9267
  }
9119
9268
  //清除临时变量
9120
9269
  walls = null;
9121
- this.restVisualAngle();
9270
+ this.visualAngle = new VisualAngle_VisualAngle(this);
9122
9271
  }
9123
9272
  focus() {
9124
9273
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9125
- for (const id in this.app.Project.objectDatas.map) {
9126
- let _object = this.app.Project.objectDatas.find(id);
9274
+ for (const id in this.app.project.objectDatas.map) {
9275
+ let _object = this.app.project.objectDatas.find(id);
9127
9276
  if (_object.parentId == this.id)
9128
- _object.setEnabled(true);
9277
+ _object.setEnabled(_object.isVisible);
9129
9278
  else
9130
9279
  _object.setEnabled(false);
9131
9280
  }
9132
9281
  this.isEnabled = true;
9282
+ this.app.project.current = this;
9133
9283
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9134
9284
  }
9135
9285
  setEnabled(_value) { }
9136
- restVisualAngle() {
9286
+ getBounding() {
9137
9287
  var min, max;
9138
- for (const _id in this.app.Project.objectDatas.map) {
9139
- let _model = this.app.Project.objectDatas.find(_id);
9288
+ for (const _id in this.app.project.objectDatas.map) {
9289
+ let _model = this.app.project.objectDatas.find(_id);
9140
9290
  if (_model.objectType == ObjectType.ParkModel || _model.objectType == ObjectType.Storey || _model.parentId != this.id)
9141
9291
  continue;
9142
9292
  let boundingInfo = _model.instance.getBoundingInfo();
@@ -9149,8 +9299,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9149
9299
  min = BABYLON.Vector3.Zero();
9150
9300
  max = new BABYLON.Vector3(12, this.height, 8);
9151
9301
  }
9152
- this.visualAngle = Tools_Tools.getVisualAngle(new BABYLON.BoundingInfo(min, max), this.app);
9153
- this.visualAngle.focus.y = this.height;
9302
+ return new BABYLON.BoundingInfo(min, max);
9154
9303
  }
9155
9304
  dispose() { }
9156
9305
  }
@@ -9227,7 +9376,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9227
9376
  let result = _corner.bind(corners);
9228
9377
  if (result) {
9229
9378
  _corner.parentId = this.id;
9230
- this.app.Project.objectDatas.add(_corner.id, _corner);
9379
+ this.app.project.objectDatas.add(_corner.id, _corner);
9231
9380
  }
9232
9381
  else
9233
9382
  _corner = null;
@@ -9270,7 +9419,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9270
9419
  let _object = new FloorObject_FloorObject(this.app);
9271
9420
  _object.height = this.height;
9272
9421
  _object.bind(_floor);
9273
- this.app.Project.objectDatas.add(_object.id, _object);
9422
+ this.app.project.objectDatas.add(_object.id, _object);
9274
9423
  }
9275
9424
  }
9276
9425
  dicVector = null;
@@ -9307,7 +9456,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9307
9456
  else
9308
9457
  continue;
9309
9458
  _object.bind(_m);
9310
- this.app.Project.objectDatas.add(_object.id, _object);
9459
+ this.app.project.objectDatas.add(_object.id, _object);
9311
9460
  }
9312
9461
  //创建未优化的墙
9313
9462
  //墙体建立
@@ -9324,7 +9473,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9324
9473
  _obejct.subMeshes.push(new BABYLON.SubMesh(0, 2, verticesCount, 30, 6, _obejct)); //2
9325
9474
  for (let w = 0; w < walls[i].wallwindows.length; w++) {
9326
9475
  const ames1 = BABYLON.CSG.FromMesh(_obejct);
9327
- let _win = this.app.Project.objectDatas.find(walls[i].wallwindows[w]);
9476
+ let _win = this.app.project.objectDatas.find(walls[i].wallwindows[w]);
9328
9477
  var bout = _win.instance.getBoundingInfo();
9329
9478
  var box = BABYLON.MeshBuilder.CreateBox(new Date().getTime().toString(), { height: bout.maximum.y - bout.minimum.y, width: bout.maximum.x - bout.minimum.x, depth: parseFloat(walls[i].ply) * 2 + 0.1 }, this.app.scene);
9330
9479
  box.position = _win.instance.position.clone();
@@ -9367,7 +9516,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9367
9516
  _wall.parentId = this.id;
9368
9517
  _wall.height = this.height;
9369
9518
  _wall.bind(beforeWalls.find(key));
9370
- this.app.Project.objectDatas.add(_wall.id, _wall);
9519
+ this.app.project.objectDatas.add(_wall.id, _wall);
9371
9520
  }
9372
9521
  }
9373
9522
  //清除临时变量
@@ -9376,8 +9525,8 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9376
9525
  }
9377
9526
  focus() {
9378
9527
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9379
- for (const id in this.app.Project.objectDatas.map) {
9380
- let _object = this.app.Project.objectDatas.find(id);
9528
+ for (const id in this.app.project.objectDatas.map) {
9529
+ let _object = this.app.project.objectDatas.find(id);
9381
9530
  if (_object.parentId == this.id)
9382
9531
  _object.setEnabled(true);
9383
9532
  else
@@ -9389,8 +9538,8 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9389
9538
  setEnabled(_value) { }
9390
9539
  restVisualAngle() {
9391
9540
  var min, max;
9392
- for (const _id in this.app.Project.objectDatas.map) {
9393
- let _model = this.app.Project.objectDatas.find(_id);
9541
+ for (const _id in this.app.project.objectDatas.map) {
9542
+ let _model = this.app.project.objectDatas.find(_id);
9394
9543
  if (_model.objectType == ObjectType.ParkModel || _model.objectType == ObjectType.Storey || _model.parentId != this.id)
9395
9544
  continue;
9396
9545
  let boundingInfo = _model.instance.getBoundingInfo();
@@ -9403,13 +9552,64 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9403
9552
  min = BABYLON.Vector3.Zero();
9404
9553
  max = new BABYLON.Vector3(12, this.height, 8);
9405
9554
  }
9406
- this.visualAngle = Tools_Tools.getVisualAngle(new BABYLON.BoundingInfo(min, max), this.app);
9555
+ this.visualAngle = Tools.getVisualAngle(new BABYLON.BoundingInfo(min, max), this.app);
9407
9556
  this.visualAngle.focus.y = this.height;
9408
9557
  }
9409
9558
  }
9410
9559
 
9411
9560
  // EXTERNAL MODULE: external "Dazzle"
9412
- var external_Dazzle_ = __webpack_require__(12);
9561
+ var external_Dazzle_ = __webpack_require__(3);
9562
+
9563
+ // CONCATENATED MODULE: ./src/lib/TipsTool.ts
9564
+ class TipsTool {
9565
+ constructor(parent, _app) {
9566
+ this.isOK = false;
9567
+ this.app = _app;
9568
+ this.ele = document.createElement("div");
9569
+ this.ele.style.cssText = 'position: absolute;z-index:999999999; font-size: 10px;color: rgb(211, 211, 211);text-shadow:rgba(0, 0, 0, 0.2) 1px 1px 0; padding: 5px 8px;';
9570
+ parent.appendChild(this.ele);
9571
+ this.close();
9572
+ setInterval(() => {
9573
+ if (new Date().getTime() - this.time > 1000 && this.isOK && !this.text) {
9574
+ let obj = this.app.project.objectDatas.find(this.id);
9575
+ if (obj)
9576
+ this.text = obj.name;
9577
+ }
9578
+ }, 100);
9579
+ }
9580
+ set text(vlaue) {
9581
+ this._text = vlaue;
9582
+ this.ele.innerText = vlaue;
9583
+ if (vlaue)
9584
+ this.ele.style.display = null;
9585
+ }
9586
+ update(e) {
9587
+ if (e.pickInfo.pickedMesh) {
9588
+ if (e.pickInfo.pickedMesh.id != this.id) {
9589
+ this.close();
9590
+ this.id = e.pickInfo.pickedMesh.id;
9591
+ this.time = new Date().getTime();
9592
+ }
9593
+ else
9594
+ this.isOK = true;
9595
+ }
9596
+ else
9597
+ this.close();
9598
+ this.ele.style.top = e.event.offsetY + "px";
9599
+ this.ele.style.left = e.event.offsetX + 20 + "px";
9600
+ }
9601
+ close() {
9602
+ this.isOK = false;
9603
+ this.time = new Date().getTime();
9604
+ this.ele.style.display = "none";
9605
+ this.text = "";
9606
+ }
9607
+ setBackground(_url) {
9608
+ this.url = _url;
9609
+ this.ele.style.background = "url(" + this.url + ") no-repeat";
9610
+ this.ele.style.backgroundSize = "cover";
9611
+ }
9612
+ }
9413
9613
 
9414
9614
  // CONCATENATED MODULE: ./src/lib/App.ts
9415
9615
 
@@ -9427,10 +9627,12 @@ var external_Dazzle_ = __webpack_require__(12);
9427
9627
 
9428
9628
 
9429
9629
 
9630
+
9430
9631
  // import Core from "../engine/Core";
9431
9632
  class App_App {
9432
9633
  constructor(_canvas, _rootUrl) {
9433
9634
  this.index = 0;
9635
+ this.highQualityMode = false;
9434
9636
  let global = external_Dazzle_["SceneLoader"].create(_canvas);
9435
9637
  this.canvas = global.canvas;
9436
9638
  this.engine = global.engine;
@@ -9449,10 +9651,8 @@ class App_App {
9449
9651
  //资源管理
9450
9652
  this.Resources = new Resources_Resources(this);
9451
9653
  //相机操作类
9452
- this.Camera = new Camera_Camera(this);
9654
+ this.camera = new Camera_Camera(this);
9453
9655
  this.highlightLayer = new BABYLON.HighlightLayer("highlightLayer", this.scene);
9454
- //自发光,有可能造成内存泄露;且性能要求较高
9455
- // this.Glow = new BABYLON.GlowLayer("glow", this.scene);
9456
9656
  // this.Glow.intensity = 5;
9457
9657
  // this.gl.gl1 = new BABYLON.GlowLayer("glow", this.scene);
9458
9658
  // this.gl.gl1.intensity = 0.25;
@@ -9462,9 +9662,10 @@ class App_App {
9462
9662
  this.container = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("screenUI");
9463
9663
  // this.toolTip = new ToolTip(this, this.container);
9464
9664
  this.Environment = new Environment_Environment(this);
9465
- this.Project = new Project_Project(this);
9665
+ this.project = new Project_Project(this);
9466
9666
  //闪烁特效
9467
9667
  src.EffectMgr = new EffectMgr_EffectMgr();
9668
+ //鼠标经过提示
9468
9669
  this.engine.runRenderLoop(() => {
9469
9670
  if (this.fps)
9470
9671
  this.fps.innerText = this.engine.getFps().toFixed() + " fps";
@@ -9482,17 +9683,21 @@ class App_App {
9482
9683
  // this.touchtime = new Date().getTime();
9483
9684
  switch (pointerInfo.type) {
9484
9685
  case BABYLON.PointerEventTypes.POINTERMOVE:
9686
+ if (!this.tipsTool)
9687
+ return;
9485
9688
  if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedPoint) {
9486
- // this.toolTip.position = pointerInfo.pickInfo.pickedPoint.clone();
9689
+ this.tipsTool.update(pointerInfo);
9487
9690
  }
9691
+ else
9692
+ this.tipsTool.close();
9488
9693
  break;
9489
9694
  case BABYLON.PointerEventTypes.POINTERWHEEL:
9490
- if (!this.Camera.isOverLook) {
9491
- let bii = 1000 / (this.Camera.camera.radius / 20);
9492
- this.Camera.camera.panningSensibility = bii > 2000 ? 2000 : bii < 10 ? 10 : bii;
9695
+ if (!this.camera.isOverLook) {
9696
+ let bii = 1000 / (this.camera.camera.radius / 20);
9697
+ this.camera.camera.panningSensibility = bii > 2000 ? 2000 : bii < 10 ? 10 : bii;
9493
9698
  }
9494
9699
  else
9495
- this.Camera._wheel(pointerInfo.event);
9700
+ this.camera._wheel(pointerInfo.event);
9496
9701
  break;
9497
9702
  }
9498
9703
  });
@@ -9502,13 +9707,16 @@ class App_App {
9502
9707
  case BABYLON.KeyboardEventTypes.KEYDOWN:
9503
9708
  {
9504
9709
  if (kbInfo.event.keyCode === 70) //按F控制台输出视角
9505
- prompt("请复制输入框内的视角参数", JSON.stringify({ alpha: this.Camera.camera.alpha, focus: Tools_Tools.vector3ToJson(this.Camera.camera.target), radius: this.Camera.camera.radius, beta: this.Camera.camera.beta }));
9710
+ prompt("请复制输入框内的视角参数", JSON.stringify({ alpha: this.camera.camera.alpha, focus: Tools.vector3ToJson(this.camera.camera.target), radius: this.camera.camera.radius, beta: this.camera.camera.beta }));
9506
9711
  }
9507
9712
  break;
9508
9713
  }
9509
9714
  });
9510
9715
  }
9511
9716
  create(_config) {
9717
+ this.highQualityMode = _config.highQualityMode;
9718
+ if (this.highQualityMode)
9719
+ this.Glow = new BABYLON.GlowLayer("glow", this.scene); //自发光,有可能造成内存泄露;且性能要求较高
9512
9720
  if (_config.libraryUrl)
9513
9721
  this.Resources.resourcePath = _config.libraryUrl;
9514
9722
  return new Promise(async (resolve, reject) => {
@@ -9518,7 +9726,7 @@ class App_App {
9518
9726
  let _data = JSON.parse(Cryptojs_Crypto.de(_projectData));
9519
9727
  // let _data = JSON.parse(_sceneData);
9520
9728
  // console.log(_data)
9521
- this.Project.id = _data.id;
9729
+ this.project.id = _data.id;
9522
9730
  this.Environment.color = _data.environmentSettings.backColor == "#7A7A7A" ? new BABYLON.Color4(0, 0.0588, 0.1176, 1) : new BABYLON.Color4(...BABYLON.Color3.FromHexString(_data.environmentSettings.backColor).asArray(), 1);
9523
9731
  this.Environment.fogDistance = _data.environmentSettings.fogDensity;
9524
9732
  this.Environment.setFlexIntensity(_data.environmentSettings.reflexIntensity);
@@ -9550,11 +9758,11 @@ class App_App {
9550
9758
  let _m = _data.scenes[i];
9551
9759
  if (_m.objectType == ObjectType.Storey || _m.objectType == ObjectType.ParkModel) {
9552
9760
  let _storey = new Region_Region(this, _m);
9553
- this.Project.objectDatas.add(_storey.id, _storey);
9761
+ this.project.objectDatas.add(_storey.id, _storey);
9554
9762
  _regions.add(_storey.id, _storey);
9555
9763
  _objects.add(_storey.id, new Array());
9556
9764
  if (_m.objectType == ObjectType.ParkModel)
9557
- this.Project.root = _storey;
9765
+ this.project.root = _storey;
9558
9766
  }
9559
9767
  else if (_m.objectType == ObjectType.Floor)
9560
9768
  _regions.add(_m.id, _m);
@@ -9570,13 +9778,13 @@ class App_App {
9570
9778
  _objects.find(_m.parentId).push(_m);
9571
9779
  }
9572
9780
  for (const _o in _objects.map) {
9573
- await this.Project.objectDatas.find(_o).bind(_objects.find(_o));
9781
+ await this.project.objectDatas.find(_o).bind(_objects.find(_o));
9574
9782
  i++;
9575
9783
  _config.progress && _config.progress(0.8 + (i / _data.scenes.length * 0.2));
9576
9784
  }
9577
9785
  _regions = null;
9578
9786
  _objects = null;
9579
- this.Project.optimization();
9787
+ this.project.optimization();
9580
9788
  // this.scene.debugLayer.show();
9581
9789
  this.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9582
9790
  resolve(null);
@@ -9593,7 +9801,7 @@ class App_App {
9593
9801
  return new Promise(async (resolve, reject) => {
9594
9802
  try {
9595
9803
  let _data = JSON.parse(Cryptojs_Crypto.de(_config.file));
9596
- this.Project.id = _data.id;
9804
+ this.project.id = _data.id;
9597
9805
  this.Environment.color = _data.environmentSettings.backColor == "#7A7A7A" ? new BABYLON.Color4(0, 0.0588, 0.1176, 1) : new BABYLON.Color4(...BABYLON.Color3.FromHexString(_data.environmentSettings.backColor).asArray(), 1);
9598
9806
  this.Environment.fogDistance = _data.environmentSettings.fogDensity;
9599
9807
  this.Environment.setFlexIntensity(_data.environmentSettings.reflexIntensity);
@@ -9625,11 +9833,11 @@ class App_App {
9625
9833
  let _m = _data.scenes[i];
9626
9834
  if (_m.objectType == ObjectType.Storey || _m.objectType == ObjectType.ParkModel) {
9627
9835
  let _storey = new OptimizedRegion_OptimizedRegion(this, _m);
9628
- this.Project.objectDatas.add(_storey.id, _storey);
9836
+ this.project.objectDatas.add(_storey.id, _storey);
9629
9837
  _regions.add(_storey.id, _storey);
9630
9838
  _objects.add(_storey.id, new Array());
9631
9839
  if (_m.objectType == ObjectType.ParkModel)
9632
- this.Project.root = _storey;
9840
+ this.project.root = _storey;
9633
9841
  }
9634
9842
  else if (_m.objectType == ObjectType.Floor)
9635
9843
  _regions.add(_m.id, _m);
@@ -9645,18 +9853,18 @@ class App_App {
9645
9853
  _objects.find(_m.parentId).push(_m);
9646
9854
  }
9647
9855
  for (const _o in _objects.map) {
9648
- await this.Project.objectDatas.find(_o).bind(_objects.find(_o), _config._isOptimized);
9856
+ await this.project.objectDatas.find(_o).bind(_objects.find(_o), _config._isOptimized);
9649
9857
  i++;
9650
9858
  _config.progress && _config.progress(0.8 + (i / _data.scenes.length * 0.2));
9651
9859
  }
9652
9860
  _regions = null;
9653
9861
  _objects = null;
9654
- this.Project.optimization();
9862
+ this.project.optimization();
9655
9863
  this.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9656
9864
  if (_config._isOptimized) {
9657
9865
  let _objectDatas = [];
9658
- for (const _id in this.Project.objectDatas.map) {
9659
- let obj = this.Project.objectDatas.find(_id);
9866
+ for (const _id in this.project.objectDatas.map) {
9867
+ let obj = this.project.objectDatas.find(_id);
9660
9868
  if (obj.objectType == ObjectType.Wall || obj.objectType == ObjectType.Corner)
9661
9869
  _objectDatas.push({ id: obj.id, parentId: obj.parentId, objectType: "optimizedWall", baseModel: obj.baseModel });
9662
9870
  }
@@ -9678,19 +9886,19 @@ class App_App {
9678
9886
  }
9679
9887
  outGltf(call) {
9680
9888
  this.Resources.delete(true);
9681
- for (const _id in this.Project.objectDatas.map) {
9682
- let obj = this.Project.objectDatas.find(_id);
9889
+ for (const _id in this.project.objectDatas.map) {
9890
+ let obj = this.project.objectDatas.find(_id);
9683
9891
  if (obj.objectType != ObjectType.Wall && obj.objectType != ObjectType.Corner) {
9684
9892
  if (obj.instance)
9685
9893
  obj.instance.dispose();
9686
- this.Project.objectDatas.remove(_id);
9894
+ this.project.objectDatas.remove(_id);
9687
9895
  }
9688
9896
  else
9689
9897
  obj.instance.material = null;
9690
9898
  }
9691
- return BABYLON.GLTF2Export.GLTFAsync(this.scene, this.Project.id, {
9899
+ return BABYLON.GLTF2Export.GLTFAsync(this.scene, this.project.id, {
9692
9900
  shouldExportNode: (e) => {
9693
- let obj = this.Project.objectDatas.find(e.id);
9901
+ let obj = this.project.objectDatas.find(e.id);
9694
9902
  return obj && (obj.objectType == ObjectType.Wall || obj.objectType == ObjectType.Corner);
9695
9903
  }
9696
9904
  }).then((exportResponse) => {
@@ -9699,29 +9907,102 @@ class App_App {
9699
9907
  call();
9700
9908
  });
9701
9909
  }
9910
+ showTips() {
9911
+ this.tipsTool = new TipsTool(this.canvas.parentElement, this);
9912
+ }
9702
9913
  //开启帧率显示
9703
- showFps(cssText = 'position: fixed;left: 5px;bottom: 5px;z-index:999999999; font-size: 10px;color: rgb(0, 255, 0);text-shadow:rgba(0, 0, 0, 0.2) 1px 1px 0;') {
9914
+ showFps(cssText = 'position: absolute;left: 5px;bottom: 5px;z-index:999999999; font-size: 10px;color: rgb(0, 255, 0);text-shadow:rgba(0, 0, 0, 0.2) 1px 1px 0;') {
9704
9915
  if (!this.fps) {
9705
9916
  this.fps = document.createElement("div");
9706
- document.body.appendChild(this.fps);
9917
+ this.canvas.parentElement.appendChild(this.fps);
9707
9918
  }
9708
9919
  this.fps.style.cssText = cssText;
9709
9920
  }
9710
9921
  //关闭帧率显示
9711
9922
  hideFps() {
9712
9923
  if (this.fps)
9713
- document.body.removeChild(this.fps);
9924
+ this.canvas.parentElement.removeChild(this.fps);
9714
9925
  this.fps = null;
9715
9926
  }
9716
9927
  //销毁整个场景
9717
9928
  dispose() {
9718
9929
  if (this.fps)
9719
- document.body.removeChild(this.fps);
9930
+ this.canvas.parentElement.removeChild(this.fps);
9720
9931
  this.fps = null;
9721
- this.Project.delete();
9932
+ this.project.delete();
9722
9933
  this.Resources.delete();
9723
9934
  this.engine.dispose();
9724
9935
  }
9936
+ showDebug() {
9937
+ this.scene.debugLayer.show();
9938
+ }
9939
+ }
9940
+
9941
+ // CONCATENATED MODULE: ./src/lib/EffectControls.ts
9942
+
9943
+
9944
+ class EffectControls_EffectControls {
9945
+ //创建容量
9946
+ static createCapacity(_object, RATIO) {
9947
+ return external_Dazzle_["Builder"].createCapacity(_object, RATIO);
9948
+ }
9949
+ ///创建矩阵云图
9950
+ static createMatrixHeatMap(_anchor, //地板对象
9951
+ _data) {
9952
+ if (_anchor.objectType != ObjectType.Floor) {
9953
+ console.error("矩阵云图对象必须为房间!");
9954
+ return;
9955
+ }
9956
+ return external_Dazzle_["Builder"].createMatrixHeatMap({ anchor: _anchor.instance, rootUrl: _anchor.app.rootUrl, FogTex: _anchor.app.Resources.FogTex, container: _anchor.app.container, config: _data.config, displayValues: _data.displayValues, height: _data.height, isAlpha: _data.isAlpha, isLevelRender: _data.isLevelRender, isParticle: _data.isParticle, radius: _data.radius, range: _data.range });
9957
+ }
9958
+ //创建柜式云图
9959
+ static createColumnarHeatMap(_anchor, _data) {
9960
+ return external_Dazzle_["Builder"].createColumnarHeatMap({ anchor: _anchor.instance, FogTex: _anchor.app.Resources.FogTex, container: _anchor.app.container, config: _data.config, displayValues: _data.displayValues, isAlpha: _data.isAlpha, isLevelRender: _data.isLevelRender, isParticle: _data.isParticle, radius: _data.radius, range: _data.range });
9961
+ }
9962
+ }
9963
+
9964
+ // CONCATENATED MODULE: ./src/lib/UI.ts
9965
+
9966
+ class UI_UI {
9967
+ /// <summary>
9968
+ /// 创建3dUI
9969
+ /// </summary>
9970
+ /// <param name="_anchor">挂载的物体标识</param>
9971
+ /// <param name="url">图片地址</param>
9972
+ /// <param name="_scaling">大小</param>
9973
+ /// <param name="_height">相对于物体高度</param>
9974
+ /// <param name="_app">场景实例</param>
9975
+ static createIconFromMesh(_id, _anchor, url, _scaling, _height) {
9976
+ let icon = new external_Dazzle_["IconFromMesh"](_id, _anchor.instance, url, _scaling, _height, _anchor.app.scene);
9977
+ return icon;
9978
+ }
9979
+ /// <summary>
9980
+ /// 创建2d跟随UI
9981
+ /// </summary>
9982
+ static createIcon(_id, _anchor, _size, _height) {
9983
+ let icon;
9984
+ _anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9985
+ icon = new external_Dazzle_["Icon"](_id);
9986
+ icon.size = _size;
9987
+ icon.height = _height;
9988
+ icon.pint = new BABYLON.Mesh(_anchor[0].id + '_pint');
9989
+ let pos = _anchor[0].instance.getAbsolutePosition();
9990
+ // if (_anchor[0].objectType == ObjectType.Floor) {
9991
+ // pos = _anchor[0].instance.getAbsolutePivotPoint();
9992
+ // }
9993
+ icon.pint.position = pos;
9994
+ icon.pint.position.y += _height;
9995
+ icon.rect = new BABYLON.GUI.Rectangle();
9996
+ icon.rect.isPointerBlocker = false;
9997
+ icon.rect.width = _size.width + "px";
9998
+ icon.rect.height = _size.height + "px";
9999
+ icon.rect.thickness = 0;
10000
+ _anchor.app.container.addControl(icon.rect);
10001
+ icon.rect.linkWithMesh(icon.pint);
10002
+ // icon.rect.linkOffsetY = -_height;
10003
+ _anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
10004
+ return icon;
10005
+ }
9725
10006
  }
9726
10007
 
9727
10008
  // CONCATENATED MODULE: ./src/index.ts
@@ -9736,14 +10017,27 @@ class App_App {
9736
10017
 
9737
10018
 
9738
10019
 
10020
+
10021
+
10022
+ // export default class MX3D {
10023
+ // static App = App;
10024
+ // static Tools = Tools;
10025
+ // static EffectMgr: EffectMgr;
10026
+ // static EffectType = EffectType;
10027
+ // static EventType = EventType;
10028
+ // static GUID = GUID;
10029
+ // static Dictionary = Dictionary;
10030
+ // }
9739
10031
  let _EffectMgr;
9740
10032
  const MX3D = {
9741
10033
  App: App_App,
9742
- Tools: Tools_Tools,
10034
+ Tools: Tools,
10035
+ UI: UI_UI,
10036
+ ObjectType: ObjectType,
9743
10037
  EffectMgr: _EffectMgr,
9744
10038
  EffectType: EffectType,
9745
10039
  EventType: EventType,
9746
- GUID: GUID,
10040
+ EffectControls: EffectControls_EffectControls,
9747
10041
  Dictionary: Dictionary
9748
10042
  };
9749
10043
  /* harmony default export */ var src = __webpack_exports__["default"] = (MX3D);