@xeokit/xeokit-sdk 2.6.48 → 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.
Files changed (41) hide show
  1. package/dist/xeokit-sdk.cjs.js +117 -82
  2. package/dist/xeokit-sdk.es.js +117 -82
  3. package/dist/xeokit-sdk.es5.js +55 -52
  4. package/dist/xeokit-sdk.min.cjs.js +3 -3
  5. package/dist/xeokit-sdk.min.es.js +3 -3
  6. package/dist/xeokit-sdk.min.es5.js +3 -3
  7. package/package.json +1 -1
  8. package/src/plugins/StoreyViewsPlugin/Storey.js +3 -3
  9. package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +43 -3
  10. package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +2 -2
  11. package/src/viewer/Viewer.js +6 -0
  12. package/src/viewer/scene/math/rtcCoords.js +4 -4
  13. package/src/viewer/scene/model/SceneModel.js +18 -31
  14. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +2 -2
  15. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +2 -2
  16. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +2 -2
  17. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +2 -2
  18. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +2 -2
  19. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +2 -2
  20. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +2 -2
  21. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +2 -2
  22. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +2 -2
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +2 -2
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +1 -2
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +2 -2
  26. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +2 -2
  27. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +2 -2
  28. package/src/viewer/scene/model/vbo/VBORenderer.js +2 -2
  29. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +1 -1
  30. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +1 -1
  31. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
  32. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +5 -1
  33. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +1 -1
  34. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  35. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  36. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -1
  37. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
  38. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -1
  39. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -1
  40. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  41. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +1 -1
@@ -9929,9 +9929,9 @@ function rtcToWorldPos(rtcCenter, rtcPos, worldPos) {
9929
9929
  * @param rtcPlanePos
9930
9930
  * @returns {*}
9931
9931
  */
9932
- function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, rotationMatrix) {
9933
- const rtcCenter = (rotationMatrix
9934
- ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(rotationMatrix, tempVec4$1, tempVec4$1))
9932
+ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, originMatrix) {
9933
+ const rtcCenter = (originMatrix
9934
+ ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(originMatrix, tempVec4$1, tempVec4$1))
9935
9935
  : rtcOrigin);
9936
9936
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
9937
9937
  const dirNormalized = math.normalizeVec3(dir, tempVec3a$L);
@@ -51746,7 +51746,7 @@ class VBORenderer {
51746
51746
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
51747
51747
  const origin = layer._state.origin;
51748
51748
  if (origin) {
51749
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.rotationMatrix);
51749
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.matrix);
51750
51750
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
51751
51751
  } else {
51752
51752
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -52053,7 +52053,7 @@ class VBORenderer {
52053
52053
  const {camera} = model.scene;
52054
52054
  const {viewNormalMatrix, project} = camera;
52055
52055
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
52056
- const {position, rotationMatrix, rotationMatrixConjugate, worldNormalMatrix} = model;
52056
+ const {position, rotationMatrix, worldNormalMatrix} = model;
52057
52057
 
52058
52058
  if (!this._program) {
52059
52059
  this._allocate();
@@ -55062,7 +55062,7 @@ class TrianglesSnapInitRenderer$1 extends VBORenderer {
55062
55062
  const gl = scene.canvas.gl;
55063
55063
  const state = batchingLayer._state;
55064
55064
  const origin = batchingLayer._state.origin;
55065
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
55065
+ const {position, rotationMatrix} = model;
55066
55066
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
55067
55067
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
55068
55068
 
@@ -55371,7 +55371,7 @@ class TrianglesSnapRenderer$1 extends VBORenderer{
55371
55371
  const gl = scene.canvas.gl;
55372
55372
  const state = batchingLayer._state;
55373
55373
  const origin = batchingLayer._state.origin;
55374
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
55374
+ const {position, rotationMatrix} = model;
55375
55375
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
55376
55376
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
55377
55377
 
@@ -60493,7 +60493,7 @@ class TrianglesSnapInitRenderer extends VBORenderer {
60493
60493
  const camera = scene.camera;
60494
60494
  const state = instancingLayer._state;
60495
60495
  const origin = instancingLayer._state.origin;
60496
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
60496
+ const {position, rotationMatrix} = model;
60497
60497
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
60498
60498
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60499
60499
 
@@ -60829,7 +60829,7 @@ class TrianglesSnapRenderer extends VBORenderer {
60829
60829
  const gl = scene.canvas.gl;
60830
60830
  const state = instancingLayer._state;
60831
60831
  const origin = instancingLayer._state.origin;
60832
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
60832
+ const {position, rotationMatrix} = model;
60833
60833
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
60834
60834
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60835
60835
 
@@ -63013,7 +63013,7 @@ class VBOBatchingLinesSnapInitRenderer extends VBORenderer {
63013
63013
  const gl = scene.canvas.gl;
63014
63014
  const state = batchingLayer._state;
63015
63015
  const origin = batchingLayer._state.origin;
63016
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
63016
+ const {position, rotationMatrix} = model;
63017
63017
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
63018
63018
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
63019
63019
 
@@ -63322,7 +63322,7 @@ class VBOBatchingLinesSnapRenderer extends VBORenderer{
63322
63322
  const gl = scene.canvas.gl;
63323
63323
  const state = batchingLayer._state;
63324
63324
  const origin = batchingLayer._state.origin;
63325
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
63325
+ const {position, rotationMatrix} = model;
63326
63326
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
63327
63327
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
63328
63328
 
@@ -64733,7 +64733,7 @@ class VBOInstancingLinesSnapInitRenderer extends VBORenderer {
64733
64733
  const camera = scene.camera;
64734
64734
  const state = instancingLayer._state;
64735
64735
  const origin = instancingLayer._state.origin;
64736
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
64736
+ const {position, rotationMatrix} = model;
64737
64737
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
64738
64738
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
64739
64739
 
@@ -65058,7 +65058,7 @@ class VBOInstancingLinesSnapRenderer extends VBORenderer {
65058
65058
  const gl = scene.canvas.gl;
65059
65059
  const state = instancingLayer._state;
65060
65060
  const origin = instancingLayer._state.origin;
65061
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
65061
+ const {position, rotationMatrix} = model;
65062
65062
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
65063
65063
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
65064
65064
 
@@ -66966,7 +66966,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
66966
66966
  const gl = scene.canvas.gl;
66967
66967
  const state = batchingLayer._state;
66968
66968
  const origin = batchingLayer._state.origin;
66969
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
66969
+ const {position, rotationMatrix} = model;
66970
66970
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
66971
66971
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
66972
66972
 
@@ -67027,6 +67027,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67027
67027
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
67028
67028
  gl.uniform1i(this._uRenderPass, renderPass);
67029
67029
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
67030
+ gl.uniform1f(this._uPointSize, 1.0);
67030
67031
 
67031
67032
  let offset = 0;
67032
67033
  const mat4Size = 4 * 4;
@@ -67070,6 +67071,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67070
67071
  this.uInverseVectorAB = program.getLocation("snapInvVectorAB");
67071
67072
  this._uLayerNumber = program.getLocation("layerNumber");
67072
67073
  this._uCoordinateScaler = program.getLocation("coordinateScaler");
67074
+ this._uPointSize = program.getLocation("pointSize");
67073
67075
  }
67074
67076
 
67075
67077
  _bindProgram() {
@@ -67110,6 +67112,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67110
67112
  src.push("uniform vec3 uCameraEyeRtc;");
67111
67113
  src.push("uniform vec2 snapVectorA;");
67112
67114
  src.push("uniform vec2 snapInvVectorAB;");
67115
+ src.push("uniform float pointSize;");
67113
67116
  {
67114
67117
  src.push("uniform float logDepthBufFC;");
67115
67118
  src.push("out float vFragDepth;");
@@ -67157,6 +67160,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67157
67160
  src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
67158
67161
  }
67159
67162
  src.push("gl_Position = clipPos;");
67163
+ src.push("gl_PointSize = pointSize;");
67160
67164
  src.push(" }");
67161
67165
  src.push("}");
67162
67166
  return src;
@@ -67273,7 +67277,7 @@ class VBOBatchingPointsSnapRenderer extends VBORenderer{
67273
67277
  const gl = scene.canvas.gl;
67274
67278
  const state = batchingLayer._state;
67275
67279
  const origin = batchingLayer._state.origin;
67276
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
67280
+ const {position, rotationMatrix} = model;
67277
67281
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
67278
67282
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
67279
67283
 
@@ -69476,7 +69480,7 @@ class VBOInstancingPointsSnapInitRenderer extends VBORenderer {
69476
69480
  const camera = scene.camera;
69477
69481
  const state = instancingLayer._state;
69478
69482
  const origin = instancingLayer._state.origin;
69479
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
69483
+ const {position, rotationMatrix} = model;
69480
69484
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
69481
69485
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
69482
69486
 
@@ -69800,7 +69804,7 @@ class VBOInstancingPointsSnapRenderer extends VBORenderer {
69800
69804
  const gl = scene.canvas.gl;
69801
69805
  const state = instancingLayer._state;
69802
69806
  const origin = instancingLayer._state.origin;
69803
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
69807
+ const {position, rotationMatrix} = model;
69804
69808
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
69805
69809
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
69806
69810
 
@@ -70994,7 +70998,7 @@ class DTXLinesColorRenderer {
70994
70998
  const state = dataTextureLayer._state;
70995
70999
  const textureState = state.textureState;
70996
71000
  const origin = dataTextureLayer._state.origin;
70997
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
71001
+ const {position, rotationMatrix} = model;
70998
71002
  const viewMatrix = camera.viewMatrix;
70999
71003
 
71000
71004
  if (!this._program) {
@@ -71066,7 +71070,7 @@ class DTXLinesColorRenderer {
71066
71070
  if (active) {
71067
71071
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
71068
71072
  if (origin) {
71069
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, rotationMatrix);
71073
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, model.matrix);
71070
71074
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
71071
71075
  } else {
71072
71076
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -72901,7 +72905,7 @@ class DTXTrianglesColorRenderer {
72901
72905
  const state = dataTextureLayer._state;
72902
72906
  const textureState = state.textureState;
72903
72907
  const origin = dataTextureLayer._state.origin;
72904
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
72908
+ const {position, rotationMatrix} = model;
72905
72909
 
72906
72910
  if (!this._program) {
72907
72911
  this._allocate();
@@ -72979,7 +72983,7 @@ class DTXTrianglesColorRenderer {
72979
72983
  if (active) {
72980
72984
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
72981
72985
  if (origin) {
72982
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, rotationMatrix);
72986
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, model.matrix);
72983
72987
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
72984
72988
  } else {
72985
72989
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73514,7 +73518,7 @@ class DTXTrianglesSilhouetteRenderer {
73514
73518
  const state = dataTextureLayer._state;
73515
73519
  const textureState = state.textureState;
73516
73520
  const origin = dataTextureLayer._state.origin;
73517
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
73521
+ const {position, rotationMatrix} = model;
73518
73522
  const viewMatrix = camera.viewMatrix;
73519
73523
 
73520
73524
  if (!this._program) {
@@ -73613,7 +73617,7 @@ class DTXTrianglesSilhouetteRenderer {
73613
73617
  if (active) {
73614
73618
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
73615
73619
  if (origin) {
73616
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, rotationMatrix);
73620
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, model.matrix);
73617
73621
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
73618
73622
  } else {
73619
73623
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73974,7 +73978,7 @@ class DTXTrianglesEdgesRenderer {
73974
73978
  const state = dataTextureLayer._state;
73975
73979
  const textureState = state.textureState;
73976
73980
  const origin = dataTextureLayer._state.origin;
73977
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
73981
+ const {position, rotationMatrix} = model;
73978
73982
  const viewMatrix = camera.viewMatrix;
73979
73983
 
73980
73984
  if (!this._program) {
@@ -74063,7 +74067,7 @@ class DTXTrianglesEdgesRenderer {
74063
74067
  if (active) {
74064
74068
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74065
74069
  if (origin) {
74066
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, rotationMatrix);
74070
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, model.matrix);
74067
74071
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74068
74072
  } else {
74069
74073
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74388,7 +74392,7 @@ class DTXTrianglesEdgesColorRenderer {
74388
74392
  const state = dataTextureLayer._state;
74389
74393
  const textureState = state.textureState;
74390
74394
  const origin = dataTextureLayer._state.origin;
74391
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
74395
+ const {position, rotationMatrix} = model;
74392
74396
  const viewMatrix = camera.viewMatrix;
74393
74397
 
74394
74398
  if (!this._program) {
@@ -74455,7 +74459,7 @@ class DTXTrianglesEdgesColorRenderer {
74455
74459
  if (active) {
74456
74460
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74457
74461
  if (origin) {
74458
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, rotationMatrix);
74462
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, model.matrix);
74459
74463
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74460
74464
  } else {
74461
74465
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74808,7 +74812,7 @@ class DTXTrianglesPickMeshRenderer {
74808
74812
  const state = dataTextureLayer._state;
74809
74813
  const textureState = state.textureState;
74810
74814
  const origin = dataTextureLayer._state.origin;
74811
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
74815
+ const {position, rotationMatrix} = model;
74812
74816
 
74813
74817
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
74814
74818
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -74876,7 +74880,7 @@ class DTXTrianglesPickMeshRenderer {
74876
74880
  if (active) {
74877
74881
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74878
74882
  if (origin) {
74879
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, rotationMatrix);
74883
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, model.matrix);
74880
74884
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74881
74885
  } else {
74882
74886
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75234,7 +75238,7 @@ class DTXTrianglesPickDepthRenderer {
75234
75238
  const state = dataTextureLayer._state;
75235
75239
  const textureState = state.textureState;
75236
75240
  const origin = dataTextureLayer._state.origin;
75237
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
75241
+ const {position, rotationMatrix} = model;
75238
75242
 
75239
75243
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
75240
75244
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -75323,7 +75327,7 @@ class DTXTrianglesPickDepthRenderer {
75323
75327
  if (active) {
75324
75328
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75325
75329
  if (origin) {
75326
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, rotationMatrix);
75330
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, model.matrix);
75327
75331
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75328
75332
  } else {
75329
75333
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75709,7 +75713,7 @@ class DTXTrianglesSnapRenderer {
75709
75713
  const state = dataTextureLayer._state;
75710
75714
  const textureState = state.textureState;
75711
75715
  const origin = dataTextureLayer._state.origin;
75712
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
75716
+ const {position, rotationMatrix} = model;
75713
75717
  const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
75714
75718
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
75715
75719
 
@@ -75795,7 +75799,7 @@ class DTXTrianglesSnapRenderer {
75795
75799
  if (active) {
75796
75800
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75797
75801
  if (origin) {
75798
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, rotationMatrix);
75802
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, model.matrix);
75799
75803
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75800
75804
  } else {
75801
75805
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76135,7 +76139,7 @@ class DTXTrianglesSnapInitRenderer {
76135
76139
  const state = dataTextureLayer._state;
76136
76140
  const textureState = state.textureState;
76137
76141
  const origin = dataTextureLayer._state.origin;
76138
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
76142
+ const {position, rotationMatrix} = model;
76139
76143
  const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
76140
76144
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
76141
76145
 
@@ -76220,7 +76224,7 @@ class DTXTrianglesSnapInitRenderer {
76220
76224
  if (active) {
76221
76225
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76222
76226
  if (origin) {
76223
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, rotationMatrix);
76227
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, model.matrix);
76224
76228
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76225
76229
  } else {
76226
76230
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76595,7 +76599,7 @@ class DTXTrianglesOcclusionRenderer {
76595
76599
  const state = dataTextureLayer._state;
76596
76600
  const textureState = state.textureState;
76597
76601
  const origin = dataTextureLayer._state.origin;
76598
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
76602
+ const {position, rotationMatrix} = model;
76599
76603
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
76600
76604
 
76601
76605
  if (!this._program) {
@@ -76669,7 +76673,7 @@ class DTXTrianglesOcclusionRenderer {
76669
76673
  if (active) {
76670
76674
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76671
76675
  if (origin) {
76672
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, rotationMatrix);
76676
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, model.matrix);
76673
76677
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76674
76678
  } else {
76675
76679
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76994,7 +76998,7 @@ class DTXTrianglesDepthRenderer {
76994
76998
  const state = dataTextureLayer._state;
76995
76999
  const textureState = state.textureState;
76996
77000
  const origin = dataTextureLayer._state.origin;
76997
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
77001
+ const {position, rotationMatrix} = model;
76998
77002
 
76999
77003
  if (!this._program) {
77000
77004
  this._allocate();
@@ -77072,7 +77076,7 @@ class DTXTrianglesDepthRenderer {
77072
77076
  if (active) {
77073
77077
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77074
77078
  if (origin) {
77075
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, rotationMatrix);
77079
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, model.matrix);
77076
77080
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77077
77081
  } else {
77078
77082
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77453,7 +77457,7 @@ class DTXTrianglesNormalsRenderer {
77453
77457
  const gl = scene.canvas.gl;
77454
77458
  const state = dataTextureLayer._state;
77455
77459
  const origin = dataTextureLayer._state.origin;
77456
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
77460
+ const {position, rotationMatrix} = model;
77457
77461
  const viewMatrix = camera.viewMatrix;
77458
77462
 
77459
77463
  if (!this._program) {
@@ -77523,7 +77527,7 @@ class DTXTrianglesNormalsRenderer {
77523
77527
  if (active) {
77524
77528
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77525
77529
  if (origin) {
77526
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, rotationMatrix);
77530
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, model.matrix);
77527
77531
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77528
77532
  } else {
77529
77533
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77800,7 +77804,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77800
77804
  const state = dataTextureLayer._state;
77801
77805
  const textureState = state.textureState;
77802
77806
  const origin = dataTextureLayer._state.origin;
77803
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
77807
+ const {position, rotationMatrix} = model;
77804
77808
 
77805
77809
  if (!this._program) {
77806
77810
  this._allocate();
@@ -77882,7 +77886,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77882
77886
  if (active) {
77883
77887
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77884
77888
  if (origin) {
77885
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, rotationMatrix);
77889
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, model.matrix);
77886
77890
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77887
77891
  } else {
77888
77892
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -84297,9 +84301,7 @@ class SceneModel extends Component {
84297
84301
  * @type {Number[]}
84298
84302
  */
84299
84303
  get matrix() {
84300
- if (this._matrixDirty) {
84301
- this._rebuildMatrices();
84302
- }
84304
+ this._rebuildMatrices();
84303
84305
  return this._matrix;
84304
84306
  }
84305
84307
 
@@ -84309,9 +84311,7 @@ class SceneModel extends Component {
84309
84311
  * @type {Number[]}
84310
84312
  */
84311
84313
  get rotationMatrix() {
84312
- if (this._matrixDirty) {
84313
- this._rebuildMatrices();
84314
- }
84314
+ this._rebuildMatrices();
84315
84315
  return this._worldRotationMatrix;
84316
84316
  }
84317
84317
 
@@ -84320,9 +84320,12 @@ class SceneModel extends Component {
84320
84320
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84321
84321
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84322
84322
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84323
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
84324
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
84323
84325
  this._matrix.set(this._worldRotationMatrix);
84324
84326
  math.translateMat4v(this._position, this._matrix);
84325
84327
  this._matrixDirty = false;
84328
+ this._viewMatrixDirty = true;
84326
84329
  }
84327
84330
  }
84328
84331
 
@@ -84334,9 +84337,7 @@ class SceneModel extends Component {
84334
84337
  * @type {Number[]}
84335
84338
  */
84336
84339
  get rotationMatrixConjugate() {
84337
- if (this._matrixDirty) {
84338
- this._rebuildMatrices();
84339
- }
84340
+ this._rebuildMatrices();
84340
84341
  return this._worldRotationMatrixConjugate;
84341
84342
  }
84342
84343
 
@@ -84380,6 +84381,16 @@ class SceneModel extends Component {
84380
84381
  return this._worldNormalMatrix;
84381
84382
  }
84382
84383
 
84384
+ _rebuildViewMatrices() {
84385
+ this._rebuildMatrices();
84386
+ if (this._viewMatrixDirty) {
84387
+ math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
84388
+ math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84389
+ math.transposeMat4(this._viewNormalMatrix);
84390
+ this._viewMatrixDirty = false;
84391
+ }
84392
+ }
84393
+
84383
84394
  /**
84384
84395
  * Called by private renderers in ./lib, returns the view matrix with which to
84385
84396
  * render this SceneModel. The view matrix is the concatenation of the
@@ -84391,16 +84402,7 @@ class SceneModel extends Component {
84391
84402
  if (!this._viewMatrix) {
84392
84403
  return this.scene.camera.viewMatrix;
84393
84404
  }
84394
- if (this._matrixDirty) {
84395
- this._rebuildMatrices();
84396
- this._viewMatrixDirty = true;
84397
- }
84398
- if (this._viewMatrixDirty) {
84399
- math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
84400
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84401
- math.transposeMat4(this._viewNormalMatrix);
84402
- this._viewMatrixDirty = false;
84403
- }
84405
+ this._rebuildViewMatrices();
84404
84406
  return this._viewMatrix;
84405
84407
  }
84406
84408
 
@@ -84413,18 +84415,7 @@ class SceneModel extends Component {
84413
84415
  if (!this._viewNormalMatrix) {
84414
84416
  return this.scene.camera.viewNormalMatrix;
84415
84417
  }
84416
- if (this._matrixDirty) {
84417
- this._rebuildMatrices();
84418
- this._viewMatrixDirty = true;
84419
- }
84420
- if (this._viewMatrixDirty) {
84421
- math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
84422
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84423
- math.transposeMat4(this._viewNormalMatrix);
84424
- this._viewMatrixDirty = false;
84425
- }
84426
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84427
- math.transposeMat4(this._viewNormalMatrix);
84418
+ this._rebuildViewMatrices();
84428
84419
  return this._viewNormalMatrix;
84429
84420
  }
84430
84421
 
@@ -110490,9 +110481,13 @@ class Viewer {
110490
110481
  //for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
110491
110482
  //resulting in increase/decreased size for the the canvas that is being overlapped
110492
110483
  const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
110484
+ const off = math.vec2([ 0, 0 ]);
110485
+ transformToNode(canvas, containerElement, off);
110493
110486
  await html2canvas(containerElement, {
110494
110487
  canvas: snapshotCanvas,
110495
110488
  backgroundColor: null,
110489
+ x: off[0],
110490
+ y: off[1],
110496
110491
  scale
110497
110492
  });
110498
110493
  }
@@ -122972,7 +122967,7 @@ class Storey {
122972
122967
  /**
122973
122968
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122974
122969
  *
122975
- * The boundary is a six-element Float32Array containing the min/max extents of the
122970
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122976
122971
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122977
122972
  *
122978
122973
  * @property storeyAABB
@@ -122983,7 +122978,7 @@ class Storey {
122983
122978
  /**
122984
122979
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122985
122980
  *
122986
- * The boundary is a six-element Float32Array containing the min/max extents of the
122981
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122987
122982
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122988
122983
  *
122989
122984
  * @deprecated
@@ -122995,7 +122990,7 @@ class Storey {
122995
122990
  /**
122996
122991
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
122997
122992
  *
122998
- * The boundary is a six-element Float32Array containing the min/max extents of the
122993
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122999
122994
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
123000
122995
  *
123001
122996
  * @property modelAABB
@@ -123320,6 +123315,8 @@ class StoreyViewsPlugin extends Plugin {
123320
123315
  */
123321
123316
  this.storeys = {};
123322
123317
 
123318
+ this._storeysList = null;
123319
+
123323
123320
  /**
123324
123321
  * A set of {@link Storey}s for each {@link MetaModel}.
123325
123322
  *
@@ -123361,6 +123358,7 @@ class StoreyViewsPlugin extends Plugin {
123361
123358
  this.fire("storeys", this.storeys);
123362
123359
  });
123363
123360
  this.storeys[storeyId] = storey;
123361
+ this._storeysList= null;
123364
123362
  if (!this.modelStoreys[modelId]) {
123365
123363
  this.modelStoreys[modelId] = {};
123366
123364
  }
@@ -123381,6 +123379,7 @@ class StoreyViewsPlugin extends Plugin {
123381
123379
  model.off(storey._onModelDestroyed);
123382
123380
  }
123383
123381
  delete this.storeys[storyObjectId];
123382
+ this._storeysList= null;
123384
123383
  }
123385
123384
  }
123386
123385
  delete this.modelStoreys[modelId];
@@ -123485,7 +123484,7 @@ class StoreyViewsPlugin extends Plugin {
123485
123484
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
123486
123485
  * @param {*} [options] Options for showing the Entitys within the storey.
123487
123486
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
123488
- */
123487
+ */
123489
123488
  showStoreyObjects(storeyId, options = {}) {
123490
123489
 
123491
123490
  const storey = this.storeys[storeyId];
@@ -123510,7 +123509,7 @@ class StoreyViewsPlugin extends Plugin {
123510
123509
 
123511
123510
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
123512
123511
  if (entity) {
123513
- entity.visible = true;
123512
+ entity.visible = true;
123514
123513
  }
123515
123514
  });
123516
123515
  }
@@ -123746,7 +123745,7 @@ class StoreyViewsPlugin extends Plugin {
123746
123745
 
123747
123746
  /**
123748
123747
  * Gets the ID of the storey which's bounding box contains the y point of the world position
123749
- *
123748
+ *
123750
123749
  * @param {Number[]} worldPos 3D World-space position.
123751
123750
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
123752
123751
  */
@@ -123866,6 +123865,42 @@ class StoreyViewsPlugin extends Plugin {
123866
123865
  this.viewer.scene.off(this._onModelLoaded);
123867
123866
  super.destroy();
123868
123867
  }
123868
+
123869
+ /**
123870
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
123871
+ *
123872
+ * @returns {null}
123873
+ */
123874
+ get storeysList() {
123875
+ if (!this._storeysList) {
123876
+ this._storeysList = Object.values(this.storeys);
123877
+ this._storeysList.sort(this._getSpatialSortFunc());
123878
+ }
123879
+ return this._storeysList;
123880
+ }
123881
+
123882
+ _getSpatialSortFunc() {
123883
+ const viewer = this.viewer;
123884
+ const scene = viewer.scene;
123885
+ const camera = scene.camera;
123886
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
123887
+ let idx = 0;
123888
+ if (camera.xUp) {
123889
+ idx = 0;
123890
+ } else if (camera.yUp) {
123891
+ idx = 1;
123892
+ } else {
123893
+ idx = 2;
123894
+ }
123895
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
123896
+ return -1;
123897
+ }
123898
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
123899
+ return 1;
123900
+ }
123901
+ return 0;
123902
+ });
123903
+ }
123869
123904
  }
123870
123905
 
123871
123906
  const zeroVec = new Float64Array([0, 0, 1]);
@@ -127428,8 +127463,8 @@ class TreeViewPlugin extends Plugin {
127428
127463
  if (!children || children.length === 0) {
127429
127464
  return;
127430
127465
  }
127431
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
127432
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
127466
+ const firstChild = children[0];
127467
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
127433
127468
  children.sort(this._getSpatialSortFunc());
127434
127469
  } else {
127435
127470
  children.sort(this._alphaSortFunc);