mx3d 0.0.11 → 0.0.15

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"]);
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
7
  exports["MX3D"] = factory(root["TWEEN"]);
8
8
  else
9
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__) {
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__(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));
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,7 +1817,7 @@ 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) {
@@ -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) {
@@ -2342,12 +2348,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2342
2348
 
2343
2349
  }));
2344
2350
 
2345
- /***/ }),
2346
- /* 7 */
2347
- /***/ (function(module, exports) {
2348
-
2349
- module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
2350
-
2351
2351
  /***/ }),
2352
2352
  /* 8 */
2353
2353
  /***/ (function(module, exports, __webpack_require__) {
@@ -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) {
@@ -6932,6 +6932,9 @@ class Camera_Camera {
6932
6932
  constructor(_app) {
6933
6933
  this.app = _app;
6934
6934
  this.camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 4, Math.PI / 4, 50, new BABYLON.Vector3(0, 0, 0), this.app.scene);
6935
+ console.log(this.camera.pinchDeltaPercentage);
6936
+ // this.camera.pinchDeltaPercentage=0.01;
6937
+ this.camera.pinchPrecision = 200;
6935
6938
  this.app.scene.activeCamera = this.camera;
6936
6939
  this.camera.attachControl(this.app.canvas, true, true);
6937
6940
  this.camera.minZ = 0.3;
@@ -7360,6 +7363,12 @@ class Tools {
7360
7363
  static getAngleFromVector3(startV, coreV, endV) {
7361
7364
  return this.getAngleFromVector2(new BABYLON.Vector2(startV.x, startV.z), new BABYLON.Vector2(coreV.x, coreV.z), new BABYLON.Vector2(endV.x, endV.z));
7362
7365
  }
7366
+ static RandomNumBoth(Min, Max) {
7367
+ var Range = Max - Min;
7368
+ var Rand = Math.random();
7369
+ var num = Min + Math.round(Rand * Range); //四舍五入
7370
+ return num;
7371
+ }
7363
7372
  }
7364
7373
 
7365
7374
  // CONCATENATED MODULE: ./src/lib/Environment.ts
@@ -7540,7 +7549,7 @@ class ReadJSON {
7540
7549
  }
7541
7550
 
7542
7551
  // EXTERNAL MODULE: ./node_modules/crypto-js/index.js
7543
- var crypto_js = __webpack_require__(3);
7552
+ var crypto_js = __webpack_require__(4);
7544
7553
  var crypto_js_default = /*#__PURE__*/__webpack_require__.n(crypto_js);
7545
7554
 
7546
7555
  // CONCATENATED MODULE: ./src/lib/Cryptojs.ts
@@ -7781,8 +7790,10 @@ class Project_Project {
7781
7790
  delete() {
7782
7791
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
7783
7792
  for (const _o in this.objectDatas.map) {
7784
- this.objectDatas.find(_o).instance.dispose();
7793
+ if (this.objectDatas.find(_o).instance)
7794
+ this.objectDatas.find(_o).instance.dispose();
7785
7795
  }
7796
+ this.objectDatas.clear();
7786
7797
  this.current = null;
7787
7798
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
7788
7799
  }
@@ -7802,6 +7813,16 @@ class Project_Project {
7802
7813
  find(_id) {
7803
7814
  return this.objectDatas.find(_id);
7804
7815
  }
7816
+ findFormObjectType(_type, isCurent = true) {
7817
+ let _objects = new Array();
7818
+ for (const id in this.objectDatas.map) {
7819
+ let _object = this.app.project.objectDatas.find(id);
7820
+ if ((isCurent && _object.parentId != this.current.id) || _object.objectType != _type)
7821
+ continue;
7822
+ _objects.push(_object);
7823
+ }
7824
+ return _objects;
7825
+ }
7805
7826
  show() {
7806
7827
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
7807
7828
  for (const id in this.app.project.objectDatas.map) {
@@ -7841,6 +7862,7 @@ class Resources_Resources {
7841
7862
  this.transparentBox.visibility = 0.3;
7842
7863
  let boxId = GUID.getGUID(12);
7843
7864
  this.BOX = BABYLON.MeshBuilder.CreateBox(boxId, { size: 1 }, this.app.scene);
7865
+ this.BOX.edgesColor = BABYLON.Color4.FromHexString("#4ba3fff2");
7844
7866
  // this.BOX.registerInstancedBuffer("color", 4);
7845
7867
  // this.BOX.instancedBuffers.color = new BABYLON.Color4(1, 0, 0, 1);
7846
7868
  this.BOX.setEnabled(false);
@@ -7864,10 +7886,14 @@ class Resources_Resources {
7864
7886
  _mesh.animationGroups[0].stop();
7865
7887
  _mesh.addAllToScene();
7866
7888
  _mesh.meshes[0].setEnabled(false);
7867
- _mesh.meshes[0].getChildMeshes().forEach(e => {
7868
- // if (e.material) e.material.freeze();
7869
- if (e.metadata && e.metadata.gltf && e.metadata.gltf.extras && (e.metadata.gltf.extras.U || e.metadata.gltf.extras.V))
7889
+ _mesh.meshes[0].getChildMeshes().forEach(m => {
7890
+ if (m.metadata && m.metadata.gltf && m.metadata.gltf.extras) {
7870
7891
  _mesh.isExtras = true;
7892
+ if (m.metadata.gltf.extras.U)
7893
+ BABYLON.Animation.CreateAndStartAnimation("u", m.material.albedoTexture, "uOffset", m.metadata.gltf.extras.Uspeed * 30, 30, 0, 1, 1);
7894
+ if (m.metadata.gltf.extras.V)
7895
+ BABYLON.Animation.CreateAndStartAnimation("v", m.material.albedoTexture, "vOffset", m.metadata.gltf.extras.Vspeed * 30, 30, 0, 1, 1);
7896
+ }
7871
7897
  });
7872
7898
  if (baseModel.objectType != ObjectType.OutDoorScene && !_mesh.isExtras) {
7873
7899
  _mesh.meshes[0].getChildMeshes().forEach(e => {
@@ -8138,7 +8164,7 @@ class DefaultObject_DefaultObject {
8138
8164
  this.isAutoPlay = _m.isAutoPlay;
8139
8165
  this.isloop = _m.isloop;
8140
8166
  this.isMonitor = _m.isMonitor;
8141
- if (_m.isVisible)
8167
+ if (_m.isVisible != null)
8142
8168
  this.isVisible = _m.isVisible;
8143
8169
  this.objectType = _m.objectType;
8144
8170
  let _o = new BABYLON.Mesh(this.id, this.app.scene);
@@ -8165,7 +8191,6 @@ class DefaultObject_DefaultObject {
8165
8191
  this.instance.position.y = (bound.maximum.y - bound.minimum.y) / 2 + _o.position.y;
8166
8192
  this.instance.rotation = _o.rotation.clone();
8167
8193
  _o.setParent(this.instance);
8168
- this.instance.setBoundingInfo(bound);
8169
8194
  this.alwaysActive();
8170
8195
  this.optimization(true);
8171
8196
  this.instance.setEnabled(false);
@@ -8175,7 +8200,6 @@ class DefaultObject_DefaultObject {
8175
8200
  // this.addEventListener(EventType.doubleClick, (x) => {
8176
8201
  // console.log(x)
8177
8202
  // x.play(true);
8178
- // x.color = { r: 1, g: 0, b: 0 }
8179
8203
  // });
8180
8204
  // this.play(true);
8181
8205
  // this.alwaysSelect();
@@ -8284,6 +8308,7 @@ class DefaultObject_DefaultObject {
8284
8308
  if (e.instancedBuffers)
8285
8309
  e.instancedBuffers.color = new BABYLON.Color4(1, 1, 1, 1);
8286
8310
  });
8311
+ this.instance.disableEdgesRendering();
8287
8312
  this.instance.visibility = 0;
8288
8313
  this.setEnabled(this.isEnabled);
8289
8314
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
@@ -8296,6 +8321,7 @@ class DefaultObject_DefaultObject {
8296
8321
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8297
8322
  this.instance.getChildMeshes().forEach(e => e.setEnabled(false));
8298
8323
  this.instance.visibility = alpha;
8324
+ this.instance.enableEdgesRendering();
8299
8325
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8300
8326
  this.effectType = EffectType.Transparent;
8301
8327
  }
@@ -8501,25 +8527,6 @@ class CabinetObject_CabinetObject extends DefaultObject_DefaultObject {
8501
8527
 
8502
8528
  //漏水线
8503
8529
  class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8504
- // set transparent(_value: boolean) {
8505
- // if (this._transparent == _value) return;
8506
- // this._transparent = _value;
8507
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8508
- // if (this._transparent) this.instance.getChildMeshes().forEach(x => x.visibility = 0.2);
8509
- // else this.instance.getChildMeshes().forEach(x => x.visibility = 1);
8510
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8511
- // }
8512
- // constructor(_app: App) {
8513
- // super();
8514
- // this.app = _app;
8515
- // }
8516
- // set color(_value: { r: number, g: number, b: number }) {
8517
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
8518
- // this.instance.getChildMeshes().forEach(e => {
8519
- // e.instancedBuffers.color = new BABYLON.Color4(_value.r, _value.g, _value.b, 1);
8520
- // })
8521
- // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
8522
- // }
8523
8530
  bind(_l) {
8524
8531
  let lines = src.Tools.ToARRVector3(_l.lines);
8525
8532
  this.instance = src.Tools.createTube(_l.id, lines, 0.02, this.app);
@@ -8532,8 +8539,7 @@ class LeakWaterObject_LeakWaterObject extends DefaultObject_DefaultObject {
8532
8539
  this.isMonitor = _l.isMonitor;
8533
8540
  var material0 = this.app.Resources.GetMaterial(_l.baseModel, this.app.scene).clone(this.id);
8534
8541
  BABYLON.Animation.CreateAndStartAnimation("u", material0.diffuseTexture, "vOffset", 15, 30, 0, 1, 1);
8535
- if (_l.baseModel.isTiling)
8536
- material0.diffuseTexture.vScale = this.instance.getTotalVertices() / 200;
8542
+ material0.diffuseTexture.vScale = this.instance.getTotalVertices() / 50;
8537
8543
  this.instance.material = material0;
8538
8544
  this.alwaysActive();
8539
8545
  this.optimization(true);
@@ -8966,6 +8972,72 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8966
8972
  }
8967
8973
  }
8968
8974
 
8975
+ // CONCATENATED MODULE: ./src/lib/components/AirFlowObject.ts
8976
+
8977
+
8978
+
8979
+ //气流模拟
8980
+ class AirFlowObject_AirFlowObject extends DefaultObject_DefaultObject {
8981
+ bind(_m) {
8982
+ this.id = _m.id;
8983
+ this.name = _m.name;
8984
+ this.parentId = _m.parentId;
8985
+ this.modelId = _m.baseModel.modelId;
8986
+ this.animation = true;
8987
+ this.isAutoPlay = true;
8988
+ this.isloop = true;
8989
+ this.isVisible = false;
8990
+ this.isMonitor = _m.isMonitor;
8991
+ if (_m.isVisible != null)
8992
+ this.isVisible = _m.isVisible;
8993
+ this.objectType = _m.objectType;
8994
+ let _o = new BABYLON.Mesh(this.id, this.app.scene);
8995
+ let res = this.app.Resources.resources.find(this.modelId);
8996
+ res.meshes[0].getChildMeshes().forEach(x => {
8997
+ var m = x.createInstance(this.id);
8998
+ m.isPickable = false;
8999
+ m.enablePointerMoveEvents = false;
9000
+ m.parent = _o;
9001
+ });
9002
+ _o.rotation = src.Tools.ToVector3(_m.rotation);
9003
+ _o.position = src.Tools.ToVector3(_m.position);
9004
+ _o.scaling = src.Tools.ToVector3(_m.scaling);
9005
+ let bound = src.Tools.computeBounds(_o);
9006
+ _o.setBoundingInfo(bound);
9007
+ this.instance = _o;
9008
+ this.alwaysActive();
9009
+ this.optimization(true);
9010
+ this.instance.setEnabled(false);
9011
+ this.visualAngle = new VisualAngle_VisualAngle(this);
9012
+ if (this.isAutoPlay)
9013
+ this.play();
9014
+ }
9015
+ setFlash(_level) {
9016
+ }
9017
+ setTransparent(_alpha) {
9018
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9019
+ this.setEnabled(false);
9020
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9021
+ }
9022
+ setOpaque() {
9023
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9024
+ this.setEnabled(true);
9025
+ this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9026
+ }
9027
+ play() {
9028
+ // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9029
+ // this.instance.getChildMeshes().forEach(m => {
9030
+ // if (m.metadata && m.metadata.gltf && m.metadata.gltf.extras) {
9031
+ // 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);
9032
+ // 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);
9033
+ // }
9034
+ // });
9035
+ // this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9036
+ }
9037
+ stop() {
9038
+ }
9039
+ }
9040
+
8969
9041
  // CONCATENATED MODULE: ./src/lib/components/Region.ts
8970
9042
 
8971
9043
 
@@ -8984,6 +9056,7 @@ class BuildingObject_BuildingObject extends DefaultObject_DefaultObject {
8984
9056
 
8985
9057
 
8986
9058
 
9059
+
8987
9060
  class Region_Region extends DefaultObject_DefaultObject {
8988
9061
  constructor(app, _storey) {
8989
9062
  super(app);
@@ -9125,6 +9198,8 @@ class Region_Region extends DefaultObject_DefaultObject {
9125
9198
  continue;
9126
9199
  else if (_m.objectType == ObjectType.Floor)
9127
9200
  continue;
9201
+ else if (_m.objectType == ObjectType.AirFlow)
9202
+ _object = new AirFlowObject_AirFlowObject(this.app);
9128
9203
  else
9129
9204
  _object = new DefaultObject_DefaultObject(this.app);
9130
9205
  _object.bind(_m);
@@ -9202,11 +9277,12 @@ class Region_Region extends DefaultObject_DefaultObject {
9202
9277
  for (const id in this.app.project.objectDatas.map) {
9203
9278
  let _object = this.app.project.objectDatas.find(id);
9204
9279
  if (_object.parentId == this.id)
9205
- _object.setEnabled(true);
9280
+ _object.setEnabled(_object.isVisible);
9206
9281
  else
9207
9282
  _object.setEnabled(false);
9208
9283
  }
9209
9284
  this.isEnabled = true;
9285
+ this.app.project.current = this;
9210
9286
  this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
9211
9287
  }
9212
9288
  setEnabled(_value) { }
@@ -9485,7 +9561,58 @@ class OptimizedRegion_OptimizedRegion extends DefaultObject_DefaultObject {
9485
9561
  }
9486
9562
 
9487
9563
  // EXTERNAL MODULE: external "Dazzle"
9488
- var external_Dazzle_ = __webpack_require__(7);
9564
+ var external_Dazzle_ = __webpack_require__(3);
9565
+
9566
+ // CONCATENATED MODULE: ./src/lib/TipsTool.ts
9567
+ class TipsTool {
9568
+ constructor(parent, _app) {
9569
+ this.isOK = false;
9570
+ this.app = _app;
9571
+ this.ele = document.createElement("div");
9572
+ 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;';
9573
+ parent.appendChild(this.ele);
9574
+ this.close();
9575
+ setInterval(() => {
9576
+ if (new Date().getTime() - this.time > 1000 && this.isOK && !this.text) {
9577
+ let obj = this.app.project.objectDatas.find(this.id);
9578
+ if (obj)
9579
+ this.text = obj.name;
9580
+ }
9581
+ }, 100);
9582
+ }
9583
+ set text(vlaue) {
9584
+ this._text = vlaue;
9585
+ this.ele.innerText = vlaue;
9586
+ if (vlaue)
9587
+ this.ele.style.display = null;
9588
+ }
9589
+ update(e) {
9590
+ if (e.pickInfo.pickedMesh) {
9591
+ if (e.pickInfo.pickedMesh.id != this.id) {
9592
+ this.close();
9593
+ this.id = e.pickInfo.pickedMesh.id;
9594
+ this.time = new Date().getTime();
9595
+ }
9596
+ else
9597
+ this.isOK = true;
9598
+ }
9599
+ else
9600
+ this.close();
9601
+ this.ele.style.top = e.event.offsetY + "px";
9602
+ this.ele.style.left = e.event.offsetX + 20 + "px";
9603
+ }
9604
+ close() {
9605
+ this.isOK = false;
9606
+ this.time = new Date().getTime();
9607
+ this.ele.style.display = "none";
9608
+ this.text = "";
9609
+ }
9610
+ setBackground(_url) {
9611
+ this.url = _url;
9612
+ this.ele.style.background = "url(" + this.url + ") no-repeat";
9613
+ this.ele.style.backgroundSize = "cover";
9614
+ }
9615
+ }
9489
9616
 
9490
9617
  // CONCATENATED MODULE: ./src/lib/App.ts
9491
9618
 
@@ -9503,6 +9630,7 @@ var external_Dazzle_ = __webpack_require__(7);
9503
9630
 
9504
9631
 
9505
9632
 
9633
+
9506
9634
  // import Core from "../engine/Core";
9507
9635
  class App_App {
9508
9636
  constructor(_canvas, _rootUrl) {
@@ -9540,6 +9668,7 @@ class App_App {
9540
9668
  this.project = new Project_Project(this);
9541
9669
  //闪烁特效
9542
9670
  src.EffectMgr = new EffectMgr_EffectMgr();
9671
+ //鼠标经过提示
9543
9672
  this.engine.runRenderLoop(() => {
9544
9673
  if (this.fps)
9545
9674
  this.fps.innerText = this.engine.getFps().toFixed() + " fps";
@@ -9557,9 +9686,13 @@ class App_App {
9557
9686
  // this.touchtime = new Date().getTime();
9558
9687
  switch (pointerInfo.type) {
9559
9688
  case BABYLON.PointerEventTypes.POINTERMOVE:
9689
+ if (!this.tipsTool)
9690
+ return;
9560
9691
  if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedPoint) {
9561
- // this.toolTip.position = pointerInfo.pickInfo.pickedPoint.clone();
9692
+ this.tipsTool.update(pointerInfo);
9562
9693
  }
9694
+ else
9695
+ this.tipsTool.close();
9563
9696
  break;
9564
9697
  case BABYLON.PointerEventTypes.POINTERWHEEL:
9565
9698
  if (!this.camera.isOverLook) {
@@ -9777,46 +9910,101 @@ class App_App {
9777
9910
  call();
9778
9911
  });
9779
9912
  }
9913
+ showTips() {
9914
+ this.tipsTool = new TipsTool(this.canvas.parentElement, this);
9915
+ }
9780
9916
  //开启帧率显示
9781
- 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;') {
9917
+ 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;') {
9782
9918
  if (!this.fps) {
9783
9919
  this.fps = document.createElement("div");
9784
- document.body.appendChild(this.fps);
9920
+ this.canvas.parentElement.appendChild(this.fps);
9785
9921
  }
9786
9922
  this.fps.style.cssText = cssText;
9787
9923
  }
9788
9924
  //关闭帧率显示
9789
9925
  hideFps() {
9790
9926
  if (this.fps)
9791
- document.body.removeChild(this.fps);
9927
+ this.canvas.parentElement.removeChild(this.fps);
9792
9928
  this.fps = null;
9793
9929
  }
9794
9930
  //销毁整个场景
9795
9931
  dispose() {
9796
9932
  if (this.fps)
9797
- document.body.removeChild(this.fps);
9933
+ this.canvas.parentElement.removeChild(this.fps);
9798
9934
  this.fps = null;
9799
9935
  this.project.delete();
9800
9936
  this.Resources.delete();
9801
9937
  this.engine.dispose();
9802
9938
  }
9939
+ showDebug() {
9940
+ this.scene.debugLayer.show();
9941
+ }
9803
9942
  }
9804
9943
 
9805
- // CONCATENATED MODULE: ./src/lib/HeatMapMgr.ts
9944
+ // CONCATENATED MODULE: ./src/lib/EffectControls.ts
9806
9945
 
9807
9946
 
9808
- class HeatMapMgr_HeatMapMgr {
9947
+ class EffectControls_EffectControls {
9948
+ //创建容量
9949
+ static createCapacity(_object, RATIO, _text, _fontSize = "200px") {
9950
+ return external_Dazzle_["Builder"].createCapacity(_object, RATIO, _text, _fontSize);
9951
+ }
9809
9952
  ///创建矩阵云图
9810
- static createMatrixHeatMap(_anchor, _config, _displayValues = true, _height = 0.5, _isAlpha = true, _isParticle = true, _radius = 2.8, _range = { max: 30, min: 16 }) {
9953
+ static createMatrixHeatMap(_anchor, //地板对象
9954
+ _data) {
9811
9955
  if (_anchor.objectType != ObjectType.Floor) {
9812
9956
  console.error("矩阵云图对象必须为房间!");
9813
9957
  return;
9814
9958
  }
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);
9959
+ 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 });
9816
9960
  }
9817
9961
  //创建柜式云图
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);
9962
+ static createColumnarHeatMap(_anchor, _data) {
9963
+ 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 });
9964
+ }
9965
+ }
9966
+
9967
+ // CONCATENATED MODULE: ./src/lib/UI.ts
9968
+
9969
+ class UI_UI {
9970
+ /// <summary>
9971
+ /// 创建3dUI
9972
+ /// </summary>
9973
+ /// <param name="_anchor">挂载的物体标识</param>
9974
+ /// <param name="url">图片地址</param>
9975
+ /// <param name="_scaling">大小</param>
9976
+ /// <param name="_height">相对于物体高度</param>
9977
+ /// <param name="_app">场景实例</param>
9978
+ static createIconFromMesh(_id, _anchor, url, _scaling, _height) {
9979
+ let icon = new external_Dazzle_["IconFromMesh"](_id, _anchor.instance, url, _scaling, _height, _anchor.app.scene);
9980
+ return icon;
9981
+ }
9982
+ /// <summary>
9983
+ /// 创建2d跟随UI
9984
+ /// </summary>
9985
+ static createIcon(_id, _anchor, _size, _height) {
9986
+ let icon;
9987
+ _anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
9988
+ icon = new external_Dazzle_["Icon"](_id);
9989
+ icon.size = _size;
9990
+ icon.height = _height;
9991
+ icon.pint = new BABYLON.Mesh(_anchor[0].id + '_pint');
9992
+ let pos = _anchor[0].instance.getAbsolutePosition();
9993
+ // if (_anchor[0].objectType == ObjectType.Floor) {
9994
+ // pos = _anchor[0].instance.getAbsolutePivotPoint();
9995
+ // }
9996
+ icon.pint.position = pos;
9997
+ icon.pint.position.y += _height;
9998
+ icon.rect = new BABYLON.GUI.Rectangle();
9999
+ icon.rect.isPointerBlocker = false;
10000
+ icon.rect.width = _size.width + "px";
10001
+ icon.rect.height = _size.height + "px";
10002
+ icon.rect.thickness = 0;
10003
+ _anchor.app.container.addControl(icon.rect);
10004
+ icon.rect.linkWithMesh(icon.pint);
10005
+ // icon.rect.linkOffsetY = -_height;
10006
+ _anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
10007
+ return icon;
9820
10008
  }
9821
10009
  }
9822
10010
 
@@ -9832,6 +10020,8 @@ class HeatMapMgr_HeatMapMgr {
9832
10020
 
9833
10021
 
9834
10022
 
10023
+
10024
+
9835
10025
  // export default class MX3D {
9836
10026
  // static App = App;
9837
10027
  // static Tools = Tools;
@@ -9845,10 +10035,12 @@ let _EffectMgr;
9845
10035
  const MX3D = {
9846
10036
  App: App_App,
9847
10037
  Tools: Tools,
10038
+ UI: UI_UI,
10039
+ ObjectType: ObjectType,
9848
10040
  EffectMgr: _EffectMgr,
9849
10041
  EffectType: EffectType,
9850
10042
  EventType: EventType,
9851
- HeatMapMgr: HeatMapMgr_HeatMapMgr,
10043
+ EffectControls: EffectControls_EffectControls,
9852
10044
  Dictionary: Dictionary
9853
10045
  };
9854
10046
  /* harmony default export */ var src = __webpack_exports__["default"] = (MX3D);