@xeokit/xeokit-sdk 2.6.49 → 2.6.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.49",
3
+ "version": "2.6.50",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -41,7 +41,7 @@ class Storey {
41
41
  /**
42
42
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
43
43
  *
44
- * The boundary is a six-element Float32Array containing the min/max extents of the
44
+ * The boundary is a six-element Float64Array containing the min/max extents of the
45
45
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
46
46
  *
47
47
  * @property storeyAABB
@@ -52,7 +52,7 @@ class Storey {
52
52
  /**
53
53
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
54
54
  *
55
- * The boundary is a six-element Float32Array containing the min/max extents of the
55
+ * The boundary is a six-element Float64Array containing the min/max extents of the
56
56
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
57
57
  *
58
58
  * @deprecated
@@ -64,7 +64,7 @@ class Storey {
64
64
  /**
65
65
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
66
66
  *
67
- * The boundary is a six-element Float32Array containing the min/max extents of the
67
+ * The boundary is a six-element Float64Array containing the min/max extents of the
68
68
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
69
69
  *
70
70
  * @property modelAABB
@@ -258,6 +258,8 @@ class StoreyViewsPlugin extends Plugin {
258
258
  */
259
259
  this.storeys = {};
260
260
 
261
+ this._storeysList = null;
262
+
261
263
  /**
262
264
  * A set of {@link Storey}s for each {@link MetaModel}.
263
265
  *
@@ -299,6 +301,7 @@ class StoreyViewsPlugin extends Plugin {
299
301
  this.fire("storeys", this.storeys);
300
302
  });
301
303
  this.storeys[storeyId] = storey;
304
+ this._storeysList= null;
302
305
  if (!this.modelStoreys[modelId]) {
303
306
  this.modelStoreys[modelId] = {};
304
307
  }
@@ -319,6 +322,7 @@ class StoreyViewsPlugin extends Plugin {
319
322
  model.off(storey._onModelDestroyed);
320
323
  }
321
324
  delete this.storeys[storyObjectId];
325
+ this._storeysList= null;
322
326
  }
323
327
  }
324
328
  delete this.modelStoreys[modelId];
@@ -423,7 +427,7 @@ class StoreyViewsPlugin extends Plugin {
423
427
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
424
428
  * @param {*} [options] Options for showing the Entitys within the storey.
425
429
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
426
- */
430
+ */
427
431
  showStoreyObjects(storeyId, options = {}) {
428
432
 
429
433
  const storey = this.storeys[storeyId];
@@ -448,7 +452,7 @@ class StoreyViewsPlugin extends Plugin {
448
452
 
449
453
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
450
454
  if (entity) {
451
- entity.visible = true;
455
+ entity.visible = true;
452
456
  }
453
457
  });
454
458
  }
@@ -684,7 +688,7 @@ class StoreyViewsPlugin extends Plugin {
684
688
 
685
689
  /**
686
690
  * Gets the ID of the storey which's bounding box contains the y point of the world position
687
- *
691
+ *
688
692
  * @param {Number[]} worldPos 3D World-space position.
689
693
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
690
694
  */
@@ -804,6 +808,42 @@ class StoreyViewsPlugin extends Plugin {
804
808
  this.viewer.scene.off(this._onModelLoaded);
805
809
  super.destroy();
806
810
  }
811
+
812
+ /**
813
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
814
+ *
815
+ * @returns {null}
816
+ */
817
+ get storeysList() {
818
+ if (!this._storeysList) {
819
+ this._storeysList = Object.values(this.storeys);
820
+ this._storeysList.sort(this._getSpatialSortFunc());
821
+ }
822
+ return this._storeysList;
823
+ }
824
+
825
+ _getSpatialSortFunc() {
826
+ const viewer = this.viewer;
827
+ const scene = viewer.scene;
828
+ const camera = scene.camera;
829
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
830
+ let idx = 0;
831
+ if (camera.xUp) {
832
+ idx = 0;
833
+ } else if (camera.yUp) {
834
+ idx = 1;
835
+ } else {
836
+ idx = 2;
837
+ }
838
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
839
+ return -1;
840
+ }
841
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
842
+ return 1;
843
+ }
844
+ return 0;
845
+ });
846
+ }
807
847
  }
808
848
 
809
849
  export {StoreyViewsPlugin}
@@ -1204,8 +1204,8 @@ export class TreeViewPlugin extends Plugin {
1204
1204
  if (!children || children.length === 0) {
1205
1205
  return;
1206
1206
  }
1207
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
1208
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
1207
+ const firstChild = children[0];
1208
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
1209
1209
  children.sort(this._getSpatialSortFunc());
1210
1210
  } else {
1211
1211
  children.sort(this._alphaSortFunc);
@@ -1602,6 +1602,8 @@ export class SceneModel extends Component {
1602
1602
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
1603
1603
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
1604
1604
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
1605
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
1606
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
1605
1607
  this._matrix.set(this._worldRotationMatrix);
1606
1608
  math.translateMat4v(this._position, this._matrix);
1607
1609
  this._matrixDirty = false;