mx3d 0.0.10 → 0.0.11

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
@@ -1,13 +1,13 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(root["TWEEN"], root["Dazzle"], root["BABYLON"], root["babylonjs-materials"], root["BABYLON.GUI"], root["BABYLON.SceneLoader"], root["babylonjs-serializers"]);
3
+ module.exports = factory(root["TWEEN"]);
4
4
  else if(typeof define === 'function' && define.amd)
5
5
  define(["TWEEN", "Dazzle", "BABYLON", "babylonjs-materials", "BABYLON.GUI", "BABYLON.SceneLoader", "babylonjs-serializers"], factory);
6
6
  else if(typeof exports === 'object')
7
- exports["MX3D"] = factory(require("TWEEN"), require("Dazzle"), require("BABYLON"), require("babylonjs-materials"), require("BABYLON.GUI"), require("BABYLON.SceneLoader"), require("babylonjs-serializers"));
7
+ exports["MX3D"] = factory(root["TWEEN"]);
8
8
  else
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__) {
9
+ root["MX3D"] = factory(root["TWEEN"]);
10
+ })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__7__, __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 = {};
@@ -1801,7 +1801,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
1801
1801
  ;(function (root, factory, undef) {
1802
1802
  if (true) {
1803
1803
  // 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));
1804
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8), __webpack_require__(20), __webpack_require__(21), __webpack_require__(5), __webpack_require__(22), __webpack_require__(6), __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__(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));
1805
1805
  }
1806
1806
  else {}
1807
1807
  }(this, function (CryptoJS) {
@@ -1817,7 +1817,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
1817
1817
  ;(function (root, factory, undef) {
1818
1818
  if (true) {
1819
1819
  // CommonJS
1820
- module.exports = exports = factory(__webpack_require__(0), __webpack_require__(8), __webpack_require__(9));
1820
+ module.exports = exports = factory(__webpack_require__(0), __webpack_require__(9), __webpack_require__(10));
1821
1821
  }
1822
1822
  else {}
1823
1823
  }(this, function (CryptoJS) {
@@ -2344,6 +2344,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2344
2344
 
2345
2345
  /***/ }),
2346
2346
  /* 7 */
2347
+ /***/ (function(module, exports) {
2348
+
2349
+ module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
2350
+
2351
+ /***/ }),
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) {
@@ -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;
@@ -7467,7 +7466,7 @@ class Environment_Environment {
7467
7466
  _light.id = _oldLight.id;
7468
7467
  _light.lightType = _oldLight.lightType;
7469
7468
  _light.name = _oldLight.name;
7470
- _light.direction = Tools_Tools.ToVector3(_oldLight.direction);
7469
+ _light.direction = Tools.ToVector3(_oldLight.direction);
7471
7470
  _light.color = _oldLight.color;
7472
7471
  _light.intensity = _oldLight.intensity;
7473
7472
  }
@@ -7476,8 +7475,8 @@ class Environment_Environment {
7476
7475
  _light.id = _oldLight.id;
7477
7476
  _light.lightType = _oldLight.lightType;
7478
7477
  _light.name = _oldLight.name;
7479
- _light.direction = Tools_Tools.ToVector3(_oldLight.direction);
7480
- _light.position = Tools_Tools.ToVector3(_oldLight.position);
7478
+ _light.direction = Tools.ToVector3(_oldLight.direction);
7479
+ _light.position = Tools.ToVector3(_oldLight.position);
7481
7480
  _light.color = _oldLight.color;
7482
7481
  _light.intensity = _oldLight.intensity;
7483
7482
  }
@@ -7486,8 +7485,8 @@ class Environment_Environment {
7486
7485
  _light.id = _oldLight.id;
7487
7486
  _light.lightType = _oldLight.lightType;
7488
7487
  _light.name = _oldLight.name;
7489
- _light.direction = Tools_Tools.ToVector3(_oldLight.direction);
7490
- _light.position = Tools_Tools.ToVector3(_oldLight.position);
7488
+ _light.direction = Tools.ToVector3(_oldLight.direction);
7489
+ _light.position = Tools.ToVector3(_oldLight.position);
7491
7490
  _light.angle = _oldLight.angle;
7492
7491
  _light.exponent = _oldLight.exponent;
7493
7492
  _light.range = _oldLight.range;
@@ -7499,7 +7498,7 @@ class Environment_Environment {
7499
7498
  _light.id = _oldLight.id;
7500
7499
  _light.lightType = _oldLight.lightType;
7501
7500
  _light.name = _oldLight.name;
7502
- _light.position = Tools_Tools.ToVector3(_oldLight.position);
7501
+ _light.position = Tools.ToVector3(_oldLight.position);
7503
7502
  _light.range = _oldLight.range;
7504
7503
  _light.color = _oldLight.color;
7505
7504
  _light.intensity = _oldLight.intensity;
@@ -7564,7 +7563,7 @@ class EffectMgr_EffectMgr {
7564
7563
  5: BABYLON.Color3.Green()
7565
7564
  };
7566
7565
  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);
7566
+ let tyiji1 = new external_TWEEN_default.a.Tween(this.colors[1]).to({ r: 1, g: 0.5, b: 0.5 }, 500);
7568
7567
  tyiji1.chain(tyiji);
7569
7568
  tyiji.chain(tyiji1);
7570
7569
  tyiji.start();
@@ -7791,12 +7790,10 @@ class Project_Project {
7791
7790
  //冻结活动网格,与自发光合用回导致内存泄露
7792
7791
  this.app.scene.freezeActiveMeshes();
7793
7792
  }
7794
- getTreeData() {
7795
- }
7796
- getChildNode(_id) {
7793
+ getChildNodes(_id) {
7797
7794
  let _objects = new Array();
7798
7795
  for (const id in this.objectDatas.map) {
7799
- let _object = this.app.Project.objectDatas.find(id);
7796
+ let _object = this.app.project.objectDatas.find(id);
7800
7797
  if (_object.parentId == _id && _object.objectType != ObjectType.Wall && _object.objectType != ObjectType.Corner)
7801
7798
  _objects.push(_object);
7802
7799
  }
@@ -7807,8 +7804,8 @@ class Project_Project {
7807
7804
  }
7808
7805
  show() {
7809
7806
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
7810
- for (const id in this.app.Project.objectDatas.map) {
7811
- let _object = this.app.Project.objectDatas.find(id);
7807
+ for (const id in this.app.project.objectDatas.map) {
7808
+ let _object = this.app.project.objectDatas.find(id);
7812
7809
  _object.setEnabled(true);
7813
7810
  }
7814
7811
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
@@ -7892,10 +7889,10 @@ class Resources_Resources {
7892
7889
  BABYLON.SceneLoader.LoadAssetContainerAsync(this.resourcePath + "Bundle/" + baseModel.modelId + "/", baseModel.modelId + baseModel.extension, this.app.scene).then((container) => {
7893
7890
  if (container.animationGroups.length > 0)
7894
7891
  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
- });
7892
+ // container.meshes[0].getChildMeshes().forEach(e => {
7893
+ // (e as BABYLON.Mesh).registerInstancedBuffer("color", 4);
7894
+ // e.instancedBuffers.color = new BABYLON.Color4(1, 1, 1, 1);
7895
+ // });
7899
7896
  this.resources.add(baseModel.modelId, container);
7900
7897
  callback(container);
7901
7898
  }).catch(() => {
@@ -8031,6 +8028,55 @@ var EventType;
8031
8028
  EventType["out"] = "out";
8032
8029
  })(EventType || (EventType = {}));
8033
8030
 
8031
+ // CONCATENATED MODULE: ./src/lib/VisualAngle.ts
8032
+
8033
+
8034
+ class VisualAngle_VisualAngle {
8035
+ constructor(_object) {
8036
+ this.object = _object;
8037
+ //重新计算包围盒
8038
+ if (this.object instanceof Region_Region) {
8039
+ let bound = this.object.getBounding();
8040
+ let _vis = src.Tools.getVisualAngle(bound, this.object.app);
8041
+ this.alpha = _vis.alpha;
8042
+ this.beta = _vis.beta;
8043
+ this.focus = _vis.focus;
8044
+ this.radius = bound.boundingSphere.radiusWorld + 3;
8045
+ this.focus.y = this.object.height;
8046
+ }
8047
+ else {
8048
+ let bound = this.object.instance.getBoundingInfo();
8049
+ let _vis = src.Tools.getVisualAngle(bound, this.object.app);
8050
+ this.alpha = _vis.alpha;
8051
+ this.beta = _vis.beta;
8052
+ this.focus = this.object.instance.getAbsolutePosition();
8053
+ this.radius = bound.boundingSphere.radiusWorld + 3;
8054
+ }
8055
+ this.minimumLimit = 0.3;
8056
+ this.maximumLimit = this.radius * 2;
8057
+ this.minBeta = 0.01;
8058
+ this.maxBeta = (Math.PI / 2) * 0.98;
8059
+ }
8060
+ //设置视角参数
8061
+ setVisual(_visual) {
8062
+ let config = JSON.parse(_visual);
8063
+ this.alpha = config.alpha;
8064
+ this.beta = config.beta;
8065
+ this.radius = config.radius;
8066
+ this.focus = src.Tools.ToVector3(config.focus);
8067
+ }
8068
+ //设置缩放范围
8069
+ setLimit(_miniLimit, _maxiLimit) {
8070
+ this.minimumLimit = _miniLimit + 0.3;
8071
+ this.maximumLimit = _maxiLimit;
8072
+ }
8073
+ //设置上下视角限制
8074
+ setBeta(_minBeta, _maxBeta) {
8075
+ this.minBeta = _minBeta;
8076
+ this.maxBeta = _maxBeta;
8077
+ }
8078
+ }
8079
+
8034
8080
  // CONCATENATED MODULE: ./src/lib/EffectType.ts
8035
8081
  var EffectType;
8036
8082
  (function (EffectType) {
@@ -8044,6 +8090,7 @@ var EffectType;
8044
8090
 
8045
8091
 
8046
8092
 
8093
+
8047
8094
  class DefaultObject_DefaultObject {
8048
8095
  constructor(_app) {
8049
8096
  this.isVisible = true;
@@ -8054,8 +8101,6 @@ class DefaultObject_DefaultObject {
8054
8101
  this._isMonitor = true;
8055
8102
  this.app = _app;
8056
8103
  }
8057
- ;
8058
- ;
8059
8104
  set isMonitor(_value) {
8060
8105
  this._isMonitor = _value;
8061
8106
  }
@@ -8084,20 +8129,14 @@ class DefaultObject_DefaultObject {
8084
8129
  get showBoundingBox() {
8085
8130
  return this.instance.showBoundingBox;
8086
8131
  }
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
8132
  bind(_m) {
8097
8133
  this.id = _m.id;
8098
8134
  this.name = _m.name;
8099
8135
  this.parentId = _m.parentId;
8100
8136
  this.modelId = _m.baseModel.modelId;
8137
+ this.animation = _m.animation;
8138
+ this.isAutoPlay = _m.isAutoPlay;
8139
+ this.isloop = _m.isloop;
8101
8140
  this.isMonitor = _m.isMonitor;
8102
8141
  if (_m.isVisible)
8103
8142
  this.isVisible = _m.isVisible;
@@ -8127,11 +8166,12 @@ class DefaultObject_DefaultObject {
8127
8166
  this.instance.rotation = _o.rotation.clone();
8128
8167
  _o.setParent(this.instance);
8129
8168
  this.instance.setBoundingInfo(bound);
8130
- // this.instance.getChildMeshes().forEach(e => e.setParent(box));
8131
8169
  this.alwaysActive();
8132
8170
  this.optimization(true);
8133
8171
  this.instance.setEnabled(false);
8134
- this.restVisualAngle();
8172
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8173
+ if (this.isAutoPlay)
8174
+ this.play();
8135
8175
  // this.addEventListener(EventType.doubleClick, (x) => {
8136
8176
  // console.log(x)
8137
8177
  // x.play(true);
@@ -8140,13 +8180,6 @@ class DefaultObject_DefaultObject {
8140
8180
  // this.play(true);
8141
8181
  // this.alwaysSelect();
8142
8182
  }
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
8183
  //true:优化,false:取消优化
8151
8184
  optimization(_isOptimization) {
8152
8185
  this.instance.getChildMeshes().forEach(x => {
@@ -8229,19 +8262,53 @@ class DefaultObject_DefaultObject {
8229
8262
  }
8230
8263
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8231
8264
  }
8232
- setFlash(_level) { }
8233
- setOpaque() { }
8234
- setTransparent() { }
8235
- play(isloop = false) {
8265
+ //设置告警闪烁
8266
+ setFlash(_level) {
8267
+ if (this.effectType != EffectType.Opaque)
8268
+ return;
8269
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8270
+ this.instance.getChildMeshes().forEach(e => {
8271
+ if (e.instancedBuffers)
8272
+ e.instancedBuffers.color = src.EffectMgr.colors[_level];
8273
+ });
8274
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8275
+ this.effectType = EffectType.Flash;
8276
+ }
8277
+ //设置正常
8278
+ setOpaque() {
8279
+ if (this.effectType == EffectType.Opaque)
8280
+ return;
8281
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8282
+ this.instance.getChildMeshes().forEach(e => {
8283
+ e.setEnabled(true);
8284
+ if (e.instancedBuffers)
8285
+ e.instancedBuffers.color = new BABYLON.Color4(1, 1, 1, 1);
8286
+ });
8287
+ this.instance.visibility = 0;
8288
+ this.setEnabled(this.isEnabled);
8289
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8290
+ this.effectType = EffectType.Opaque;
8291
+ }
8292
+ //设置半透明
8293
+ setTransparent(alpha = 0.3) {
8294
+ if (this.effectType != EffectType.Opaque)
8295
+ return;
8296
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8297
+ this.instance.getChildMeshes().forEach(e => e.setEnabled(false));
8298
+ this.instance.visibility = alpha;
8299
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8300
+ this.effectType = EffectType.Transparent;
8301
+ }
8302
+ play() {
8236
8303
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8237
8304
  this.instance.getChildMeshes().forEach(m => {
8238
8305
  let open;
8239
8306
  m.animations.forEach((e) => { if (e.name.indexOf("open") != -1)
8240
8307
  open = e; });
8241
8308
  if (open)
8242
- this.app.scene.beginDirectAnimation(m, [open], 0, open.getKeys().length * 10, isloop);
8309
+ this.app.scene.beginDirectAnimation(m, [open], 0, open.getKeys().length * 10, this.isloop);
8243
8310
  else
8244
- m.animations.forEach((e) => this.app.scene.beginDirectAnimation(m, [e], 0, e.getKeys().length * 10, isloop));
8311
+ m.animations.forEach((e) => this.app.scene.beginDirectAnimation(m, [e], 0, e.getKeys().length * 10, this.isloop));
8245
8312
  });
8246
8313
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8247
8314
  }
@@ -8259,7 +8326,7 @@ class DefaultObject_DefaultObject {
8259
8326
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8260
8327
  }
8261
8328
  flyTo() {
8262
- this.app.Camera.flyTo(this.visualAngle, 500);
8329
+ this.app.camera.flyTo(this.visualAngle, 500);
8263
8330
  }
8264
8331
  focus() {
8265
8332
  // this.app.Camera.focusingFromProperty(this.visualAngle);
@@ -8307,6 +8374,7 @@ class WallObject_WallObject extends DefaultObject_DefaultObject {
8307
8374
  // CONCATENATED MODULE: ./src/lib/components/WindowObject.ts
8308
8375
 
8309
8376
 
8377
+
8310
8378
  //窗户
8311
8379
  class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8312
8380
  // virtualBox: BABYLON.InstancedMesh;
@@ -8347,7 +8415,7 @@ class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8347
8415
  this.instance = new BABYLON.Mesh(this.id, this.app.scene);
8348
8416
  let res = this.app.Resources.resources.find(this.modelId);
8349
8417
  res.meshes[0].getChildMeshes().forEach(x => {
8350
- var m = x.createInstance(this.id);
8418
+ var m = this.app.highQualityMode ? x.clone(this.id) : x.createInstance(this.id);
8351
8419
  m.parent = this.instance;
8352
8420
  });
8353
8421
  let bound = src.Tools.computeBounds(this.instance);
@@ -8368,7 +8436,7 @@ class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8368
8436
  this.alwaysActive();
8369
8437
  this.optimization(true);
8370
8438
  this.instance.setEnabled(false);
8371
- this.restVisualAngle();
8439
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8372
8440
  //重新计算包围盒
8373
8441
  // this.bound = this.instance.getBoundingInfo();
8374
8442
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8381,6 +8449,7 @@ class WindowObject_WindowObject extends DefaultObject_DefaultObject {
8381
8449
  // CONCATENATED MODULE: ./src/lib/components/DoorObject.ts
8382
8450
 
8383
8451
 
8452
+
8384
8453
  //门
8385
8454
  class DoorObject_DoorObject extends DefaultObject_DefaultObject {
8386
8455
  bind(_m) {
@@ -8394,7 +8463,7 @@ class DoorObject_DoorObject extends DefaultObject_DefaultObject {
8394
8463
  this.instance = new BABYLON.Mesh(this.id, this.app.scene);
8395
8464
  let res = this.app.Resources.resources.find(this.modelId);
8396
8465
  res.meshes[0].getChildMeshes().forEach(x => {
8397
- var m = x.createInstance(this.id);
8466
+ var m = this.app.highQualityMode ? x.clone(this.id) : x.createInstance(this.id);
8398
8467
  m.parent = this.instance;
8399
8468
  });
8400
8469
  let bound = src.Tools.computeBounds(this.instance);
@@ -8415,7 +8484,7 @@ class DoorObject_DoorObject extends DefaultObject_DefaultObject {
8415
8484
  this.alwaysActive();
8416
8485
  this.optimization(true);
8417
8486
  this.instance.setEnabled(false);
8418
- this.restVisualAngle();
8487
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8419
8488
  }
8420
8489
  }
8421
8490
 
@@ -8429,6 +8498,7 @@ class CabinetObject_CabinetObject extends DefaultObject_DefaultObject {
8429
8498
 
8430
8499
 
8431
8500
 
8501
+
8432
8502
  //漏水线
8433
8503
  class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8434
8504
  // set transparent(_value: boolean) {
@@ -8467,7 +8537,7 @@ class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8467
8537
  this.instance.material = material0;
8468
8538
  this.alwaysActive();
8469
8539
  this.optimization(true);
8470
- this.restVisualAngle();
8540
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8471
8541
  // let bound = this.instance.getBoundingInfo();
8472
8542
  // this.instance.position = this.bound.boundingBox.center.clone();
8473
8543
  // this.visualAngle = MX3D.Tools.getVisualAngle(bound);
@@ -8543,6 +8613,7 @@ class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8543
8613
  // CONCATENATED MODULE: ./src/lib/components/VirtualBoxObject.ts
8544
8614
 
8545
8615
 
8616
+
8546
8617
  //虚拟盒子
8547
8618
  class VirtualBoxObject_VirtualBoxObject extends DefaultObject_DefaultObject {
8548
8619
  async bind(_m) {
@@ -8592,7 +8663,7 @@ class VirtualBoxObject_VirtualBoxObject extends DefaultObject_DefaultObject {
8592
8663
  this.instance.scaling = src.Tools.ToVector3(_m.scaling);
8593
8664
  this.alwaysActive();
8594
8665
  this.optimization(true);
8595
- this.restVisualAngle();
8666
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8596
8667
  //重新计算包围盒
8597
8668
  // this.bound = this.instance.getBoundingInfo();
8598
8669
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8605,6 +8676,7 @@ class VirtualBoxObject_VirtualBoxObject extends DefaultObject_DefaultObject {
8605
8676
  // CONCATENATED MODULE: ./src/lib/components/UI3DTextObject.ts
8606
8677
 
8607
8678
 
8679
+
8608
8680
  //3d文本
8609
8681
  class UI3DTextObject_UI3DTextObject extends DefaultObject_DefaultObject {
8610
8682
  // set transparent(_value: boolean) {
@@ -8662,7 +8734,7 @@ class UI3DTextObject_UI3DTextObject extends DefaultObject_DefaultObject {
8662
8734
  this.instance.material = mat;
8663
8735
  this.alwaysActive();
8664
8736
  this.optimization(true);
8665
- this.restVisualAngle();
8737
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8666
8738
  //重新计算包围盒
8667
8739
  // this.bound = this.instance.getBoundingInfo();
8668
8740
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8673,6 +8745,8 @@ class UI3DTextObject_UI3DTextObject extends DefaultObject_DefaultObject {
8673
8745
  }
8674
8746
 
8675
8747
  // CONCATENATED MODULE: ./src/lib/components/ConduitObject.ts
8748
+ // import MX3D from "../../index";
8749
+
8676
8750
 
8677
8751
 
8678
8752
  //墙角
@@ -8684,8 +8758,8 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
8684
8758
  this.isMonitor = _m.isMonitor;
8685
8759
  this.objectType = _m.objectType;
8686
8760
  this.isVisible = true;
8687
- let pists = src.Tools.ToARRVector3(_m.pints);
8688
- this.instance = src.Tools.createTube(_m.id, pists, _m.radius, this.app);
8761
+ let pists = Tools.ToARRVector3(_m.pints);
8762
+ this.instance = Tools.createTube(_m.id, pists, _m.radius, this.app);
8689
8763
  let mat = new BABYLON.StandardMaterial(_m.id, this.app.scene);
8690
8764
  mat.diffuseColor = BABYLON.Color3.FromHexString(_m.color);
8691
8765
  mat.alpha = _m.alpha;
@@ -8695,7 +8769,7 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
8695
8769
  this.instance.setEnabled(false);
8696
8770
  this.alwaysActive();
8697
8771
  this.optimization(true);
8698
- this.restVisualAngle();
8772
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8699
8773
  //重新计算包围盒
8700
8774
  // this.bound = this.instance.getBoundingInfo();
8701
8775
  // this.visualAngle = this.app.Tools.getVisualAngle(this.bound);
@@ -8707,6 +8781,7 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
8707
8781
  // CONCATENATED MODULE: ./src/lib/components/FloorObject.ts
8708
8782
 
8709
8783
 
8784
+
8710
8785
  //房间
8711
8786
  class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8712
8787
  bind(_m) {
@@ -8716,7 +8791,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8716
8791
  this.modelId = _m.baseModel.modelId;
8717
8792
  this.objectType = _m.objectType;
8718
8793
  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);
8794
+ this.instance = BABYLON.MeshBuilder.CreatePolygon("地板", { shape: Tools.Expand(_m.vectors, -0.01), holes: _m.buckles, sideOrientation: BABYLON.Mesh.DOUBLESIDE }, this.app.scene);
8720
8795
  this.alwaysActive();
8721
8796
  this.instance.setEnabled(false);
8722
8797
  this.instance.isPickable = false;
@@ -8727,7 +8802,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8727
8802
  this.instance.name = "地板";
8728
8803
  var material0 = this.app.Resources.GetMaterial(_m.baseModel, this.app.scene).clone(_m.id);
8729
8804
  let bound = this.instance.getBoundingInfo();
8730
- this.visualAngle = src.Tools.getVisualAngle(bound, this.app);
8805
+ this.visualAngle = Tools.getVisualAngle(bound, this.app);
8731
8806
  // let zz = this.bound.boundingBox.center;
8732
8807
  // this.instance.setPivotMatrix(BABYLON.Matrix.Translation(0, 0, 0), false);
8733
8808
  if (_m.baseModel.isTiling) {
@@ -8736,7 +8811,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8736
8811
  }
8737
8812
  this.instance.material = material0;
8738
8813
  this.optimization(true);
8739
- this.restVisualAngle();
8814
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8740
8815
  // this.nativeMaterial = material0;
8741
8816
  // this.material = this.nativeMaterial;
8742
8817
  // this.alwaysSelect();
@@ -8749,6 +8824,7 @@ class FloorObject_FloorObject extends DefaultObject_DefaultObject {
8749
8824
 
8750
8825
  // CONCATENATED MODULE: ./src/lib/components/OptimizedWallObject.ts
8751
8826
 
8827
+
8752
8828
  //墙体
8753
8829
  class OptimizedWallObject_OptimizedWallObject extends DefaultObject_DefaultObject {
8754
8830
  // set transparent(_value: boolean) {
@@ -8806,12 +8882,13 @@ class OptimizedWallObject_OptimizedWallObject extends DefaultObject_DefaultObjec
8806
8882
  this.alwaysActive();
8807
8883
  this.optimization(true);
8808
8884
  this.instance.setEnabled(false);
8809
- this.restVisualAngle();
8885
+ this.visualAngle = new VisualAngle_VisualAngle(this);
8810
8886
  }
8811
8887
  }
8812
8888
  }
8813
8889
 
8814
8890
  // CONCATENATED MODULE: ./src/lib/components/CornerObject.ts
8891
+ // import MX3D from "../../index";
8815
8892
 
8816
8893
 
8817
8894
 
@@ -8837,7 +8914,7 @@ class CornerObject_CornerObject extends DefaultObject_DefaultObject {
8837
8914
  if (meshs.length < 1)
8838
8915
  return result;
8839
8916
  if (meshs.length > 1)
8840
- this.instance = src.Tools.MergeMeshes(meshs, this.app);
8917
+ this.instance = Tools.MergeMeshes(meshs, this.app);
8841
8918
  else
8842
8919
  this.instance = meshs[0];
8843
8920
  this.instance.id = this.id;
@@ -8862,14 +8939,14 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8862
8939
  focus() {
8863
8940
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8864
8941
  let childs = new Array();
8865
- for (const id in this.app.Project.objectDatas.map) {
8866
- let _object = this.app.Project.objectDatas.find(id);
8942
+ for (const id in this.app.project.objectDatas.map) {
8943
+ let _object = this.app.project.objectDatas.find(id);
8867
8944
  if (_object.parentId == this.id)
8868
8945
  childs.push(_object);
8869
8946
  _object.setEnabled(false);
8870
8947
  }
8871
- for (const id in this.app.Project.objectDatas.map) {
8872
- let _object = this.app.Project.objectDatas.find(id);
8948
+ for (const id in this.app.project.objectDatas.map) {
8949
+ let _object = this.app.project.objectDatas.find(id);
8873
8950
  if (_object.objectType != ObjectType.Wall
8874
8951
  && _object.objectType != ObjectType.Corner
8875
8952
  && _object.objectType != ObjectType.Floor
@@ -8885,7 +8962,7 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8885
8962
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8886
8963
  }
8887
8964
  restVisualAngle() {
8888
- this.visualAngle = Tools_Tools.getVisualAngle(this.instance.getBoundingInfo(), this.app);
8965
+ this.visualAngle = Tools.getVisualAngle(this.instance.getBoundingInfo(), this.app);
8889
8966
  }
8890
8967
  }
8891
8968
 
@@ -8931,7 +9008,7 @@ class Region_Region extends DefaultObject_DefaultObject {
8931
9008
  let _wall = new OptimizedWallObject_OptimizedWallObject(this.app);
8932
9009
  _wall.bind(_nw);
8933
9010
  if (_wall.instance)
8934
- this.app.Project.objectDatas.add(_wall.id, _wall);
9011
+ this.app.project.objectDatas.add(_wall.id, _wall);
8935
9012
  }
8936
9013
  let walls = new Array();
8937
9014
  for (let i = 0; i < _storey.length; i++) {
@@ -8974,7 +9051,7 @@ class Region_Region extends DefaultObject_DefaultObject {
8974
9051
  let result = _corner.bind(corners);
8975
9052
  if (result) {
8976
9053
  _corner.parentId = this.id;
8977
- this.app.Project.objectDatas.add(_corner.id, _corner);
9054
+ this.app.project.objectDatas.add(_corner.id, _corner);
8978
9055
  }
8979
9056
  else
8980
9057
  _corner = null;
@@ -9017,7 +9094,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9017
9094
  let _object = new FloorObject_FloorObject(this.app);
9018
9095
  _object.height = this.height;
9019
9096
  _object.bind(_floor);
9020
- this.app.Project.objectDatas.add(_object.id, _object);
9097
+ this.app.project.objectDatas.add(_object.id, _object);
9021
9098
  }
9022
9099
  dicVector = null;
9023
9100
  //灯光
@@ -9051,7 +9128,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9051
9128
  else
9052
9129
  _object = new DefaultObject_DefaultObject(this.app);
9053
9130
  _object.bind(_m);
9054
- this.app.Project.objectDatas.add(_object.id, _object);
9131
+ this.app.project.objectDatas.add(_object.id, _object);
9055
9132
  }
9056
9133
  //创建未优化的墙
9057
9134
  if (!isOptimized) {
@@ -9069,7 +9146,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9069
9146
  _obejct.subMeshes.push(new BABYLON.SubMesh(0, 2, verticesCount, 30, 6, _obejct)); //2
9070
9147
  for (let w = 0; w < walls[i].wallwindows.length; w++) {
9071
9148
  const ames1 = BABYLON.CSG.FromMesh(_obejct);
9072
- let _win = this.app.Project.objectDatas.find(walls[i].wallwindows[w]);
9149
+ let _win = this.app.project.objectDatas.find(walls[i].wallwindows[w]);
9073
9150
  var bout = _win.instance.getBoundingInfo();
9074
9151
  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
9152
  box.position = _win.instance.position.clone();
@@ -9112,18 +9189,18 @@ class Region_Region extends DefaultObject_DefaultObject {
9112
9189
  _wall.parentId = this.id;
9113
9190
  _wall.height = this.height;
9114
9191
  _wall.bind(beforeWalls.find(key));
9115
- this.app.Project.objectDatas.add(_wall.id, _wall);
9192
+ this.app.project.objectDatas.add(_wall.id, _wall);
9116
9193
  }
9117
9194
  }
9118
9195
  }
9119
9196
  //清除临时变量
9120
9197
  walls = null;
9121
- this.restVisualAngle();
9198
+ this.visualAngle = new VisualAngle_VisualAngle(this);
9122
9199
  }
9123
9200
  focus() {
9124
9201
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9125
- for (const id in this.app.Project.objectDatas.map) {
9126
- let _object = this.app.Project.objectDatas.find(id);
9202
+ for (const id in this.app.project.objectDatas.map) {
9203
+ let _object = this.app.project.objectDatas.find(id);
9127
9204
  if (_object.parentId == this.id)
9128
9205
  _object.setEnabled(true);
9129
9206
  else
@@ -9133,10 +9210,10 @@ class Region_Region extends DefaultObject_DefaultObject {
9133
9210
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9134
9211
  }
9135
9212
  setEnabled(_value) { }
9136
- restVisualAngle() {
9213
+ getBounding() {
9137
9214
  var min, max;
9138
- for (const _id in this.app.Project.objectDatas.map) {
9139
- let _model = this.app.Project.objectDatas.find(_id);
9215
+ for (const _id in this.app.project.objectDatas.map) {
9216
+ let _model = this.app.project.objectDatas.find(_id);
9140
9217
  if (_model.objectType == ObjectType.ParkModel || _model.objectType == ObjectType.Storey || _model.parentId != this.id)
9141
9218
  continue;
9142
9219
  let boundingInfo = _model.instance.getBoundingInfo();
@@ -9149,8 +9226,7 @@ class Region_Region extends DefaultObject_DefaultObject {
9149
9226
  min = BABYLON.Vector3.Zero();
9150
9227
  max = new BABYLON.Vector3(12, this.height, 8);
9151
9228
  }
9152
- this.visualAngle = Tools_Tools.getVisualAngle(new BABYLON.BoundingInfo(min, max), this.app);
9153
- this.visualAngle.focus.y = this.height;
9229
+ return new BABYLON.BoundingInfo(min, max);
9154
9230
  }
9155
9231
  dispose() { }
9156
9232
  }
@@ -9227,7 +9303,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9227
9303
  let result = _corner.bind(corners);
9228
9304
  if (result) {
9229
9305
  _corner.parentId = this.id;
9230
- this.app.Project.objectDatas.add(_corner.id, _corner);
9306
+ this.app.project.objectDatas.add(_corner.id, _corner);
9231
9307
  }
9232
9308
  else
9233
9309
  _corner = null;
@@ -9270,7 +9346,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9270
9346
  let _object = new FloorObject_FloorObject(this.app);
9271
9347
  _object.height = this.height;
9272
9348
  _object.bind(_floor);
9273
- this.app.Project.objectDatas.add(_object.id, _object);
9349
+ this.app.project.objectDatas.add(_object.id, _object);
9274
9350
  }
9275
9351
  }
9276
9352
  dicVector = null;
@@ -9307,7 +9383,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9307
9383
  else
9308
9384
  continue;
9309
9385
  _object.bind(_m);
9310
- this.app.Project.objectDatas.add(_object.id, _object);
9386
+ this.app.project.objectDatas.add(_object.id, _object);
9311
9387
  }
9312
9388
  //创建未优化的墙
9313
9389
  //墙体建立
@@ -9324,7 +9400,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9324
9400
  _obejct.subMeshes.push(new BABYLON.SubMesh(0, 2, verticesCount, 30, 6, _obejct)); //2
9325
9401
  for (let w = 0; w < walls[i].wallwindows.length; w++) {
9326
9402
  const ames1 = BABYLON.CSG.FromMesh(_obejct);
9327
- let _win = this.app.Project.objectDatas.find(walls[i].wallwindows[w]);
9403
+ let _win = this.app.project.objectDatas.find(walls[i].wallwindows[w]);
9328
9404
  var bout = _win.instance.getBoundingInfo();
9329
9405
  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
9406
  box.position = _win.instance.position.clone();
@@ -9367,7 +9443,7 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9367
9443
  _wall.parentId = this.id;
9368
9444
  _wall.height = this.height;
9369
9445
  _wall.bind(beforeWalls.find(key));
9370
- this.app.Project.objectDatas.add(_wall.id, _wall);
9446
+ this.app.project.objectDatas.add(_wall.id, _wall);
9371
9447
  }
9372
9448
  }
9373
9449
  //清除临时变量
@@ -9376,8 +9452,8 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9376
9452
  }
9377
9453
  focus() {
9378
9454
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9379
- for (const id in this.app.Project.objectDatas.map) {
9380
- let _object = this.app.Project.objectDatas.find(id);
9455
+ for (const id in this.app.project.objectDatas.map) {
9456
+ let _object = this.app.project.objectDatas.find(id);
9381
9457
  if (_object.parentId == this.id)
9382
9458
  _object.setEnabled(true);
9383
9459
  else
@@ -9389,8 +9465,8 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9389
9465
  setEnabled(_value) { }
9390
9466
  restVisualAngle() {
9391
9467
  var min, max;
9392
- for (const _id in this.app.Project.objectDatas.map) {
9393
- let _model = this.app.Project.objectDatas.find(_id);
9468
+ for (const _id in this.app.project.objectDatas.map) {
9469
+ let _model = this.app.project.objectDatas.find(_id);
9394
9470
  if (_model.objectType == ObjectType.ParkModel || _model.objectType == ObjectType.Storey || _model.parentId != this.id)
9395
9471
  continue;
9396
9472
  let boundingInfo = _model.instance.getBoundingInfo();
@@ -9403,13 +9479,13 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9403
9479
  min = BABYLON.Vector3.Zero();
9404
9480
  max = new BABYLON.Vector3(12, this.height, 8);
9405
9481
  }
9406
- this.visualAngle = Tools_Tools.getVisualAngle(new BABYLON.BoundingInfo(min, max), this.app);
9482
+ this.visualAngle = Tools.getVisualAngle(new BABYLON.BoundingInfo(min, max), this.app);
9407
9483
  this.visualAngle.focus.y = this.height;
9408
9484
  }
9409
9485
  }
9410
9486
 
9411
9487
  // EXTERNAL MODULE: external "Dazzle"
9412
- var external_Dazzle_ = __webpack_require__(12);
9488
+ var external_Dazzle_ = __webpack_require__(7);
9413
9489
 
9414
9490
  // CONCATENATED MODULE: ./src/lib/App.ts
9415
9491
 
@@ -9431,6 +9507,7 @@ var external_Dazzle_ = __webpack_require__(12);
9431
9507
  class App_App {
9432
9508
  constructor(_canvas, _rootUrl) {
9433
9509
  this.index = 0;
9510
+ this.highQualityMode = false;
9434
9511
  let global = external_Dazzle_["SceneLoader"].create(_canvas);
9435
9512
  this.canvas = global.canvas;
9436
9513
  this.engine = global.engine;
@@ -9449,10 +9526,8 @@ class App_App {
9449
9526
  //资源管理
9450
9527
  this.Resources = new Resources_Resources(this);
9451
9528
  //相机操作类
9452
- this.Camera = new Camera_Camera(this);
9529
+ this.camera = new Camera_Camera(this);
9453
9530
  this.highlightLayer = new BABYLON.HighlightLayer("highlightLayer", this.scene);
9454
- //自发光,有可能造成内存泄露;且性能要求较高
9455
- // this.Glow = new BABYLON.GlowLayer("glow", this.scene);
9456
9531
  // this.Glow.intensity = 5;
9457
9532
  // this.gl.gl1 = new BABYLON.GlowLayer("glow", this.scene);
9458
9533
  // this.gl.gl1.intensity = 0.25;
@@ -9462,7 +9537,7 @@ class App_App {
9462
9537
  this.container = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("screenUI");
9463
9538
  // this.toolTip = new ToolTip(this, this.container);
9464
9539
  this.Environment = new Environment_Environment(this);
9465
- this.Project = new Project_Project(this);
9540
+ this.project = new Project_Project(this);
9466
9541
  //闪烁特效
9467
9542
  src.EffectMgr = new EffectMgr_EffectMgr();
9468
9543
  this.engine.runRenderLoop(() => {
@@ -9487,12 +9562,12 @@ class App_App {
9487
9562
  }
9488
9563
  break;
9489
9564
  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;
9565
+ if (!this.camera.isOverLook) {
9566
+ let bii = 1000 / (this.camera.camera.radius / 20);
9567
+ this.camera.camera.panningSensibility = bii > 2000 ? 2000 : bii < 10 ? 10 : bii;
9493
9568
  }
9494
9569
  else
9495
- this.Camera._wheel(pointerInfo.event);
9570
+ this.camera._wheel(pointerInfo.event);
9496
9571
  break;
9497
9572
  }
9498
9573
  });
@@ -9502,13 +9577,16 @@ class App_App {
9502
9577
  case BABYLON.KeyboardEventTypes.KEYDOWN:
9503
9578
  {
9504
9579
  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 }));
9580
+ 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
9581
  }
9507
9582
  break;
9508
9583
  }
9509
9584
  });
9510
9585
  }
9511
9586
  create(_config) {
9587
+ this.highQualityMode = _config.highQualityMode;
9588
+ if (this.highQualityMode)
9589
+ this.Glow = new BABYLON.GlowLayer("glow", this.scene); //自发光,有可能造成内存泄露;且性能要求较高
9512
9590
  if (_config.libraryUrl)
9513
9591
  this.Resources.resourcePath = _config.libraryUrl;
9514
9592
  return new Promise(async (resolve, reject) => {
@@ -9518,7 +9596,7 @@ class App_App {
9518
9596
  let _data = JSON.parse(Cryptojs_Crypto.de(_projectData));
9519
9597
  // let _data = JSON.parse(_sceneData);
9520
9598
  // console.log(_data)
9521
- this.Project.id = _data.id;
9599
+ this.project.id = _data.id;
9522
9600
  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
9601
  this.Environment.fogDistance = _data.environmentSettings.fogDensity;
9524
9602
  this.Environment.setFlexIntensity(_data.environmentSettings.reflexIntensity);
@@ -9550,11 +9628,11 @@ class App_App {
9550
9628
  let _m = _data.scenes[i];
9551
9629
  if (_m.objectType == ObjectType.Storey || _m.objectType == ObjectType.ParkModel) {
9552
9630
  let _storey = new Region_Region(this, _m);
9553
- this.Project.objectDatas.add(_storey.id, _storey);
9631
+ this.project.objectDatas.add(_storey.id, _storey);
9554
9632
  _regions.add(_storey.id, _storey);
9555
9633
  _objects.add(_storey.id, new Array());
9556
9634
  if (_m.objectType == ObjectType.ParkModel)
9557
- this.Project.root = _storey;
9635
+ this.project.root = _storey;
9558
9636
  }
9559
9637
  else if (_m.objectType == ObjectType.Floor)
9560
9638
  _regions.add(_m.id, _m);
@@ -9570,13 +9648,13 @@ class App_App {
9570
9648
  _objects.find(_m.parentId).push(_m);
9571
9649
  }
9572
9650
  for (const _o in _objects.map) {
9573
- await this.Project.objectDatas.find(_o).bind(_objects.find(_o));
9651
+ await this.project.objectDatas.find(_o).bind(_objects.find(_o));
9574
9652
  i++;
9575
9653
  _config.progress && _config.progress(0.8 + (i / _data.scenes.length * 0.2));
9576
9654
  }
9577
9655
  _regions = null;
9578
9656
  _objects = null;
9579
- this.Project.optimization();
9657
+ this.project.optimization();
9580
9658
  // this.scene.debugLayer.show();
9581
9659
  this.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9582
9660
  resolve(null);
@@ -9593,7 +9671,7 @@ class App_App {
9593
9671
  return new Promise(async (resolve, reject) => {
9594
9672
  try {
9595
9673
  let _data = JSON.parse(Cryptojs_Crypto.de(_config.file));
9596
- this.Project.id = _data.id;
9674
+ this.project.id = _data.id;
9597
9675
  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
9676
  this.Environment.fogDistance = _data.environmentSettings.fogDensity;
9599
9677
  this.Environment.setFlexIntensity(_data.environmentSettings.reflexIntensity);
@@ -9625,11 +9703,11 @@ class App_App {
9625
9703
  let _m = _data.scenes[i];
9626
9704
  if (_m.objectType == ObjectType.Storey || _m.objectType == ObjectType.ParkModel) {
9627
9705
  let _storey = new OptimizedRegion_OptimizedRegion(this, _m);
9628
- this.Project.objectDatas.add(_storey.id, _storey);
9706
+ this.project.objectDatas.add(_storey.id, _storey);
9629
9707
  _regions.add(_storey.id, _storey);
9630
9708
  _objects.add(_storey.id, new Array());
9631
9709
  if (_m.objectType == ObjectType.ParkModel)
9632
- this.Project.root = _storey;
9710
+ this.project.root = _storey;
9633
9711
  }
9634
9712
  else if (_m.objectType == ObjectType.Floor)
9635
9713
  _regions.add(_m.id, _m);
@@ -9645,18 +9723,18 @@ class App_App {
9645
9723
  _objects.find(_m.parentId).push(_m);
9646
9724
  }
9647
9725
  for (const _o in _objects.map) {
9648
- await this.Project.objectDatas.find(_o).bind(_objects.find(_o), _config._isOptimized);
9726
+ await this.project.objectDatas.find(_o).bind(_objects.find(_o), _config._isOptimized);
9649
9727
  i++;
9650
9728
  _config.progress && _config.progress(0.8 + (i / _data.scenes.length * 0.2));
9651
9729
  }
9652
9730
  _regions = null;
9653
9731
  _objects = null;
9654
- this.Project.optimization();
9732
+ this.project.optimization();
9655
9733
  this.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9656
9734
  if (_config._isOptimized) {
9657
9735
  let _objectDatas = [];
9658
- for (const _id in this.Project.objectDatas.map) {
9659
- let obj = this.Project.objectDatas.find(_id);
9736
+ for (const _id in this.project.objectDatas.map) {
9737
+ let obj = this.project.objectDatas.find(_id);
9660
9738
  if (obj.objectType == ObjectType.Wall || obj.objectType == ObjectType.Corner)
9661
9739
  _objectDatas.push({ id: obj.id, parentId: obj.parentId, objectType: "optimizedWall", baseModel: obj.baseModel });
9662
9740
  }
@@ -9678,19 +9756,19 @@ class App_App {
9678
9756
  }
9679
9757
  outGltf(call) {
9680
9758
  this.Resources.delete(true);
9681
- for (const _id in this.Project.objectDatas.map) {
9682
- let obj = this.Project.objectDatas.find(_id);
9759
+ for (const _id in this.project.objectDatas.map) {
9760
+ let obj = this.project.objectDatas.find(_id);
9683
9761
  if (obj.objectType != ObjectType.Wall && obj.objectType != ObjectType.Corner) {
9684
9762
  if (obj.instance)
9685
9763
  obj.instance.dispose();
9686
- this.Project.objectDatas.remove(_id);
9764
+ this.project.objectDatas.remove(_id);
9687
9765
  }
9688
9766
  else
9689
9767
  obj.instance.material = null;
9690
9768
  }
9691
- return BABYLON.GLTF2Export.GLTFAsync(this.scene, this.Project.id, {
9769
+ return BABYLON.GLTF2Export.GLTFAsync(this.scene, this.project.id, {
9692
9770
  shouldExportNode: (e) => {
9693
- let obj = this.Project.objectDatas.find(e.id);
9771
+ let obj = this.project.objectDatas.find(e.id);
9694
9772
  return obj && (obj.objectType == ObjectType.Wall || obj.objectType == ObjectType.Corner);
9695
9773
  }
9696
9774
  }).then((exportResponse) => {
@@ -9718,12 +9796,30 @@ class App_App {
9718
9796
  if (this.fps)
9719
9797
  document.body.removeChild(this.fps);
9720
9798
  this.fps = null;
9721
- this.Project.delete();
9799
+ this.project.delete();
9722
9800
  this.Resources.delete();
9723
9801
  this.engine.dispose();
9724
9802
  }
9725
9803
  }
9726
9804
 
9805
+ // CONCATENATED MODULE: ./src/lib/HeatMapMgr.ts
9806
+
9807
+
9808
+ class HeatMapMgr_HeatMapMgr {
9809
+ ///创建矩阵云图
9810
+ static createMatrixHeatMap(_anchor, _config, _displayValues = true, _height = 0.5, _isAlpha = true, _isParticle = true, _radius = 2.8, _range = { max: 30, min: 16 }) {
9811
+ if (_anchor.objectType != ObjectType.Floor) {
9812
+ console.error("矩阵云图对象必须为房间!");
9813
+ return;
9814
+ }
9815
+ return external_Dazzle_["Builder"].createMatrixHeatMap(_anchor.instance, _anchor.app.rootUrl, _anchor.app.Resources.FogTex, _anchor.app.container, _config, _displayValues, _height, _isAlpha, _isParticle, _radius, _range);
9816
+ }
9817
+ //创建柜式云图
9818
+ static createColumnarHeatMap(_anchor, _config, _displayValues = true, _isAlpha = true, _isParticle = true, _radius = 4, _range = { max: 30, min: 16 }) {
9819
+ return external_Dazzle_["Builder"].createColumnarHeatMap(_anchor.instance, _anchor.app.Resources.FogTex, _anchor.app.container, _config, _displayValues, _isAlpha, _isParticle, _radius, _range);
9820
+ }
9821
+ }
9822
+
9727
9823
  // CONCATENATED MODULE: ./src/index.ts
9728
9824
 
9729
9825
 
@@ -9736,14 +9832,23 @@ class App_App {
9736
9832
 
9737
9833
 
9738
9834
 
9835
+ // export default class MX3D {
9836
+ // static App = App;
9837
+ // static Tools = Tools;
9838
+ // static EffectMgr: EffectMgr;
9839
+ // static EffectType = EffectType;
9840
+ // static EventType = EventType;
9841
+ // static GUID = GUID;
9842
+ // static Dictionary = Dictionary;
9843
+ // }
9739
9844
  let _EffectMgr;
9740
9845
  const MX3D = {
9741
9846
  App: App_App,
9742
- Tools: Tools_Tools,
9847
+ Tools: Tools,
9743
9848
  EffectMgr: _EffectMgr,
9744
9849
  EffectType: EffectType,
9745
9850
  EventType: EventType,
9746
- GUID: GUID,
9851
+ HeatMapMgr: HeatMapMgr_HeatMapMgr,
9747
9852
  Dictionary: Dictionary
9748
9853
  };
9749
9854
  /* harmony default export */ var src = __webpack_exports__["default"] = (MX3D);