@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
@@ -9925,9 +9925,9 @@ function rtcToWorldPos(rtcCenter, rtcPos, worldPos) {
9925
9925
  * @param rtcPlanePos
9926
9926
  * @returns {*}
9927
9927
  */
9928
- function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, rotationMatrix) {
9929
- const rtcCenter = (rotationMatrix
9930
- ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(rotationMatrix, tempVec4$1, tempVec4$1))
9928
+ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, originMatrix) {
9929
+ const rtcCenter = (originMatrix
9930
+ ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(originMatrix, tempVec4$1, tempVec4$1))
9931
9931
  : rtcOrigin);
9932
9932
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
9933
9933
  const dirNormalized = math.normalizeVec3(dir, tempVec3a$L);
@@ -51742,7 +51742,7 @@ class VBORenderer {
51742
51742
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
51743
51743
  const origin = layer._state.origin;
51744
51744
  if (origin) {
51745
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.rotationMatrix);
51745
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.matrix);
51746
51746
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
51747
51747
  } else {
51748
51748
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -52049,7 +52049,7 @@ class VBORenderer {
52049
52049
  const {camera} = model.scene;
52050
52050
  const {viewNormalMatrix, project} = camera;
52051
52051
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
52052
- const {position, rotationMatrix, rotationMatrixConjugate, worldNormalMatrix} = model;
52052
+ const {position, rotationMatrix, worldNormalMatrix} = model;
52053
52053
 
52054
52054
  if (!this._program) {
52055
52055
  this._allocate();
@@ -55058,7 +55058,7 @@ class TrianglesSnapInitRenderer$1 extends VBORenderer {
55058
55058
  const gl = scene.canvas.gl;
55059
55059
  const state = batchingLayer._state;
55060
55060
  const origin = batchingLayer._state.origin;
55061
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
55061
+ const {position, rotationMatrix} = model;
55062
55062
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
55063
55063
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
55064
55064
 
@@ -55367,7 +55367,7 @@ class TrianglesSnapRenderer$1 extends VBORenderer{
55367
55367
  const gl = scene.canvas.gl;
55368
55368
  const state = batchingLayer._state;
55369
55369
  const origin = batchingLayer._state.origin;
55370
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
55370
+ const {position, rotationMatrix} = model;
55371
55371
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
55372
55372
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
55373
55373
 
@@ -60489,7 +60489,7 @@ class TrianglesSnapInitRenderer extends VBORenderer {
60489
60489
  const camera = scene.camera;
60490
60490
  const state = instancingLayer._state;
60491
60491
  const origin = instancingLayer._state.origin;
60492
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
60492
+ const {position, rotationMatrix} = model;
60493
60493
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
60494
60494
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60495
60495
 
@@ -60825,7 +60825,7 @@ class TrianglesSnapRenderer extends VBORenderer {
60825
60825
  const gl = scene.canvas.gl;
60826
60826
  const state = instancingLayer._state;
60827
60827
  const origin = instancingLayer._state.origin;
60828
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
60828
+ const {position, rotationMatrix} = model;
60829
60829
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
60830
60830
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60831
60831
 
@@ -63009,7 +63009,7 @@ class VBOBatchingLinesSnapInitRenderer extends VBORenderer {
63009
63009
  const gl = scene.canvas.gl;
63010
63010
  const state = batchingLayer._state;
63011
63011
  const origin = batchingLayer._state.origin;
63012
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
63012
+ const {position, rotationMatrix} = model;
63013
63013
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
63014
63014
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
63015
63015
 
@@ -63318,7 +63318,7 @@ class VBOBatchingLinesSnapRenderer extends VBORenderer{
63318
63318
  const gl = scene.canvas.gl;
63319
63319
  const state = batchingLayer._state;
63320
63320
  const origin = batchingLayer._state.origin;
63321
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
63321
+ const {position, rotationMatrix} = model;
63322
63322
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
63323
63323
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
63324
63324
 
@@ -64729,7 +64729,7 @@ class VBOInstancingLinesSnapInitRenderer extends VBORenderer {
64729
64729
  const camera = scene.camera;
64730
64730
  const state = instancingLayer._state;
64731
64731
  const origin = instancingLayer._state.origin;
64732
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
64732
+ const {position, rotationMatrix} = model;
64733
64733
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
64734
64734
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
64735
64735
 
@@ -65054,7 +65054,7 @@ class VBOInstancingLinesSnapRenderer extends VBORenderer {
65054
65054
  const gl = scene.canvas.gl;
65055
65055
  const state = instancingLayer._state;
65056
65056
  const origin = instancingLayer._state.origin;
65057
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
65057
+ const {position, rotationMatrix} = model;
65058
65058
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
65059
65059
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
65060
65060
 
@@ -66962,7 +66962,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
66962
66962
  const gl = scene.canvas.gl;
66963
66963
  const state = batchingLayer._state;
66964
66964
  const origin = batchingLayer._state.origin;
66965
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
66965
+ const {position, rotationMatrix} = model;
66966
66966
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
66967
66967
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
66968
66968
 
@@ -67023,6 +67023,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67023
67023
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
67024
67024
  gl.uniform1i(this._uRenderPass, renderPass);
67025
67025
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
67026
+ gl.uniform1f(this._uPointSize, 1.0);
67026
67027
 
67027
67028
  let offset = 0;
67028
67029
  const mat4Size = 4 * 4;
@@ -67066,6 +67067,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67066
67067
  this.uInverseVectorAB = program.getLocation("snapInvVectorAB");
67067
67068
  this._uLayerNumber = program.getLocation("layerNumber");
67068
67069
  this._uCoordinateScaler = program.getLocation("coordinateScaler");
67070
+ this._uPointSize = program.getLocation("pointSize");
67069
67071
  }
67070
67072
 
67071
67073
  _bindProgram() {
@@ -67106,6 +67108,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67106
67108
  src.push("uniform vec3 uCameraEyeRtc;");
67107
67109
  src.push("uniform vec2 snapVectorA;");
67108
67110
  src.push("uniform vec2 snapInvVectorAB;");
67111
+ src.push("uniform float pointSize;");
67109
67112
  {
67110
67113
  src.push("uniform float logDepthBufFC;");
67111
67114
  src.push("out float vFragDepth;");
@@ -67153,6 +67156,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
67153
67156
  src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
67154
67157
  }
67155
67158
  src.push("gl_Position = clipPos;");
67159
+ src.push("gl_PointSize = pointSize;");
67156
67160
  src.push(" }");
67157
67161
  src.push("}");
67158
67162
  return src;
@@ -67269,7 +67273,7 @@ class VBOBatchingPointsSnapRenderer extends VBORenderer{
67269
67273
  const gl = scene.canvas.gl;
67270
67274
  const state = batchingLayer._state;
67271
67275
  const origin = batchingLayer._state.origin;
67272
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
67276
+ const {position, rotationMatrix} = model;
67273
67277
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
67274
67278
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
67275
67279
 
@@ -69472,7 +69476,7 @@ class VBOInstancingPointsSnapInitRenderer extends VBORenderer {
69472
69476
  const camera = scene.camera;
69473
69477
  const state = instancingLayer._state;
69474
69478
  const origin = instancingLayer._state.origin;
69475
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
69479
+ const {position, rotationMatrix} = model;
69476
69480
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
69477
69481
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
69478
69482
 
@@ -69796,7 +69800,7 @@ class VBOInstancingPointsSnapRenderer extends VBORenderer {
69796
69800
  const gl = scene.canvas.gl;
69797
69801
  const state = instancingLayer._state;
69798
69802
  const origin = instancingLayer._state.origin;
69799
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
69803
+ const {position, rotationMatrix} = model;
69800
69804
  const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
69801
69805
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
69802
69806
 
@@ -70990,7 +70994,7 @@ class DTXLinesColorRenderer {
70990
70994
  const state = dataTextureLayer._state;
70991
70995
  const textureState = state.textureState;
70992
70996
  const origin = dataTextureLayer._state.origin;
70993
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
70997
+ const {position, rotationMatrix} = model;
70994
70998
  const viewMatrix = camera.viewMatrix;
70995
70999
 
70996
71000
  if (!this._program) {
@@ -71062,7 +71066,7 @@ class DTXLinesColorRenderer {
71062
71066
  if (active) {
71063
71067
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
71064
71068
  if (origin) {
71065
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, rotationMatrix);
71069
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, model.matrix);
71066
71070
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
71067
71071
  } else {
71068
71072
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -72897,7 +72901,7 @@ class DTXTrianglesColorRenderer {
72897
72901
  const state = dataTextureLayer._state;
72898
72902
  const textureState = state.textureState;
72899
72903
  const origin = dataTextureLayer._state.origin;
72900
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
72904
+ const {position, rotationMatrix} = model;
72901
72905
 
72902
72906
  if (!this._program) {
72903
72907
  this._allocate();
@@ -72975,7 +72979,7 @@ class DTXTrianglesColorRenderer {
72975
72979
  if (active) {
72976
72980
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
72977
72981
  if (origin) {
72978
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, rotationMatrix);
72982
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, model.matrix);
72979
72983
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
72980
72984
  } else {
72981
72985
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73510,7 +73514,7 @@ class DTXTrianglesSilhouetteRenderer {
73510
73514
  const state = dataTextureLayer._state;
73511
73515
  const textureState = state.textureState;
73512
73516
  const origin = dataTextureLayer._state.origin;
73513
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
73517
+ const {position, rotationMatrix} = model;
73514
73518
  const viewMatrix = camera.viewMatrix;
73515
73519
 
73516
73520
  if (!this._program) {
@@ -73609,7 +73613,7 @@ class DTXTrianglesSilhouetteRenderer {
73609
73613
  if (active) {
73610
73614
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
73611
73615
  if (origin) {
73612
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, rotationMatrix);
73616
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, model.matrix);
73613
73617
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
73614
73618
  } else {
73615
73619
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73970,7 +73974,7 @@ class DTXTrianglesEdgesRenderer {
73970
73974
  const state = dataTextureLayer._state;
73971
73975
  const textureState = state.textureState;
73972
73976
  const origin = dataTextureLayer._state.origin;
73973
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
73977
+ const {position, rotationMatrix} = model;
73974
73978
  const viewMatrix = camera.viewMatrix;
73975
73979
 
73976
73980
  if (!this._program) {
@@ -74059,7 +74063,7 @@ class DTXTrianglesEdgesRenderer {
74059
74063
  if (active) {
74060
74064
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74061
74065
  if (origin) {
74062
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, rotationMatrix);
74066
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, model.matrix);
74063
74067
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74064
74068
  } else {
74065
74069
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74384,7 +74388,7 @@ class DTXTrianglesEdgesColorRenderer {
74384
74388
  const state = dataTextureLayer._state;
74385
74389
  const textureState = state.textureState;
74386
74390
  const origin = dataTextureLayer._state.origin;
74387
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
74391
+ const {position, rotationMatrix} = model;
74388
74392
  const viewMatrix = camera.viewMatrix;
74389
74393
 
74390
74394
  if (!this._program) {
@@ -74451,7 +74455,7 @@ class DTXTrianglesEdgesColorRenderer {
74451
74455
  if (active) {
74452
74456
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74453
74457
  if (origin) {
74454
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, rotationMatrix);
74458
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, model.matrix);
74455
74459
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74456
74460
  } else {
74457
74461
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74804,7 +74808,7 @@ class DTXTrianglesPickMeshRenderer {
74804
74808
  const state = dataTextureLayer._state;
74805
74809
  const textureState = state.textureState;
74806
74810
  const origin = dataTextureLayer._state.origin;
74807
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
74811
+ const {position, rotationMatrix} = model;
74808
74812
 
74809
74813
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
74810
74814
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -74872,7 +74876,7 @@ class DTXTrianglesPickMeshRenderer {
74872
74876
  if (active) {
74873
74877
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74874
74878
  if (origin) {
74875
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, rotationMatrix);
74879
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, model.matrix);
74876
74880
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74877
74881
  } else {
74878
74882
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75230,7 +75234,7 @@ class DTXTrianglesPickDepthRenderer {
75230
75234
  const state = dataTextureLayer._state;
75231
75235
  const textureState = state.textureState;
75232
75236
  const origin = dataTextureLayer._state.origin;
75233
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
75237
+ const {position, rotationMatrix} = model;
75234
75238
 
75235
75239
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
75236
75240
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -75319,7 +75323,7 @@ class DTXTrianglesPickDepthRenderer {
75319
75323
  if (active) {
75320
75324
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75321
75325
  if (origin) {
75322
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, rotationMatrix);
75326
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, model.matrix);
75323
75327
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75324
75328
  } else {
75325
75329
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75705,7 +75709,7 @@ class DTXTrianglesSnapRenderer {
75705
75709
  const state = dataTextureLayer._state;
75706
75710
  const textureState = state.textureState;
75707
75711
  const origin = dataTextureLayer._state.origin;
75708
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
75712
+ const {position, rotationMatrix} = model;
75709
75713
  const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
75710
75714
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
75711
75715
 
@@ -75791,7 +75795,7 @@ class DTXTrianglesSnapRenderer {
75791
75795
  if (active) {
75792
75796
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75793
75797
  if (origin) {
75794
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, rotationMatrix);
75798
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, model.matrix);
75795
75799
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75796
75800
  } else {
75797
75801
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76131,7 +76135,7 @@ class DTXTrianglesSnapInitRenderer {
76131
76135
  const state = dataTextureLayer._state;
76132
76136
  const textureState = state.textureState;
76133
76137
  const origin = dataTextureLayer._state.origin;
76134
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
76138
+ const {position, rotationMatrix} = model;
76135
76139
  const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
76136
76140
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
76137
76141
 
@@ -76216,7 +76220,7 @@ class DTXTrianglesSnapInitRenderer {
76216
76220
  if (active) {
76217
76221
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76218
76222
  if (origin) {
76219
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, rotationMatrix);
76223
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, model.matrix);
76220
76224
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76221
76225
  } else {
76222
76226
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76591,7 +76595,7 @@ class DTXTrianglesOcclusionRenderer {
76591
76595
  const state = dataTextureLayer._state;
76592
76596
  const textureState = state.textureState;
76593
76597
  const origin = dataTextureLayer._state.origin;
76594
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
76598
+ const {position, rotationMatrix} = model;
76595
76599
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
76596
76600
 
76597
76601
  if (!this._program) {
@@ -76665,7 +76669,7 @@ class DTXTrianglesOcclusionRenderer {
76665
76669
  if (active) {
76666
76670
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76667
76671
  if (origin) {
76668
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, rotationMatrix);
76672
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, model.matrix);
76669
76673
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76670
76674
  } else {
76671
76675
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76990,7 +76994,7 @@ class DTXTrianglesDepthRenderer {
76990
76994
  const state = dataTextureLayer._state;
76991
76995
  const textureState = state.textureState;
76992
76996
  const origin = dataTextureLayer._state.origin;
76993
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
76997
+ const {position, rotationMatrix} = model;
76994
76998
 
76995
76999
  if (!this._program) {
76996
77000
  this._allocate();
@@ -77068,7 +77072,7 @@ class DTXTrianglesDepthRenderer {
77068
77072
  if (active) {
77069
77073
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77070
77074
  if (origin) {
77071
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, rotationMatrix);
77075
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, model.matrix);
77072
77076
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77073
77077
  } else {
77074
77078
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77449,7 +77453,7 @@ class DTXTrianglesNormalsRenderer {
77449
77453
  const gl = scene.canvas.gl;
77450
77454
  const state = dataTextureLayer._state;
77451
77455
  const origin = dataTextureLayer._state.origin;
77452
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
77456
+ const {position, rotationMatrix} = model;
77453
77457
  const viewMatrix = camera.viewMatrix;
77454
77458
 
77455
77459
  if (!this._program) {
@@ -77519,7 +77523,7 @@ class DTXTrianglesNormalsRenderer {
77519
77523
  if (active) {
77520
77524
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77521
77525
  if (origin) {
77522
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, rotationMatrix);
77526
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, model.matrix);
77523
77527
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77524
77528
  } else {
77525
77529
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77796,7 +77800,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77796
77800
  const state = dataTextureLayer._state;
77797
77801
  const textureState = state.textureState;
77798
77802
  const origin = dataTextureLayer._state.origin;
77799
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
77803
+ const {position, rotationMatrix} = model;
77800
77804
 
77801
77805
  if (!this._program) {
77802
77806
  this._allocate();
@@ -77878,7 +77882,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77878
77882
  if (active) {
77879
77883
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77880
77884
  if (origin) {
77881
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, rotationMatrix);
77885
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, model.matrix);
77882
77886
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77883
77887
  } else {
77884
77888
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -84293,9 +84297,7 @@ class SceneModel extends Component {
84293
84297
  * @type {Number[]}
84294
84298
  */
84295
84299
  get matrix() {
84296
- if (this._matrixDirty) {
84297
- this._rebuildMatrices();
84298
- }
84300
+ this._rebuildMatrices();
84299
84301
  return this._matrix;
84300
84302
  }
84301
84303
 
@@ -84305,9 +84307,7 @@ class SceneModel extends Component {
84305
84307
  * @type {Number[]}
84306
84308
  */
84307
84309
  get rotationMatrix() {
84308
- if (this._matrixDirty) {
84309
- this._rebuildMatrices();
84310
- }
84310
+ this._rebuildMatrices();
84311
84311
  return this._worldRotationMatrix;
84312
84312
  }
84313
84313
 
@@ -84316,9 +84316,12 @@ class SceneModel extends Component {
84316
84316
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84317
84317
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84318
84318
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84319
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
84320
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
84319
84321
  this._matrix.set(this._worldRotationMatrix);
84320
84322
  math.translateMat4v(this._position, this._matrix);
84321
84323
  this._matrixDirty = false;
84324
+ this._viewMatrixDirty = true;
84322
84325
  }
84323
84326
  }
84324
84327
 
@@ -84330,9 +84333,7 @@ class SceneModel extends Component {
84330
84333
  * @type {Number[]}
84331
84334
  */
84332
84335
  get rotationMatrixConjugate() {
84333
- if (this._matrixDirty) {
84334
- this._rebuildMatrices();
84335
- }
84336
+ this._rebuildMatrices();
84336
84337
  return this._worldRotationMatrixConjugate;
84337
84338
  }
84338
84339
 
@@ -84376,6 +84377,16 @@ class SceneModel extends Component {
84376
84377
  return this._worldNormalMatrix;
84377
84378
  }
84378
84379
 
84380
+ _rebuildViewMatrices() {
84381
+ this._rebuildMatrices();
84382
+ if (this._viewMatrixDirty) {
84383
+ math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
84384
+ math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84385
+ math.transposeMat4(this._viewNormalMatrix);
84386
+ this._viewMatrixDirty = false;
84387
+ }
84388
+ }
84389
+
84379
84390
  /**
84380
84391
  * Called by private renderers in ./lib, returns the view matrix with which to
84381
84392
  * render this SceneModel. The view matrix is the concatenation of the
@@ -84387,16 +84398,7 @@ class SceneModel extends Component {
84387
84398
  if (!this._viewMatrix) {
84388
84399
  return this.scene.camera.viewMatrix;
84389
84400
  }
84390
- if (this._matrixDirty) {
84391
- this._rebuildMatrices();
84392
- this._viewMatrixDirty = true;
84393
- }
84394
- if (this._viewMatrixDirty) {
84395
- math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
84396
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84397
- math.transposeMat4(this._viewNormalMatrix);
84398
- this._viewMatrixDirty = false;
84399
- }
84401
+ this._rebuildViewMatrices();
84400
84402
  return this._viewMatrix;
84401
84403
  }
84402
84404
 
@@ -84409,18 +84411,7 @@ class SceneModel extends Component {
84409
84411
  if (!this._viewNormalMatrix) {
84410
84412
  return this.scene.camera.viewNormalMatrix;
84411
84413
  }
84412
- if (this._matrixDirty) {
84413
- this._rebuildMatrices();
84414
- this._viewMatrixDirty = true;
84415
- }
84416
- if (this._viewMatrixDirty) {
84417
- math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
84418
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84419
- math.transposeMat4(this._viewNormalMatrix);
84420
- this._viewMatrixDirty = false;
84421
- }
84422
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
84423
- math.transposeMat4(this._viewNormalMatrix);
84414
+ this._rebuildViewMatrices();
84424
84415
  return this._viewNormalMatrix;
84425
84416
  }
84426
84417
 
@@ -110486,9 +110477,13 @@ class Viewer {
110486
110477
  //for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
110487
110478
  //resulting in increase/decreased size for the the canvas that is being overlapped
110488
110479
  const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
110480
+ const off = math.vec2([ 0, 0 ]);
110481
+ transformToNode(canvas, containerElement, off);
110489
110482
  await html2canvas(containerElement, {
110490
110483
  canvas: snapshotCanvas,
110491
110484
  backgroundColor: null,
110485
+ x: off[0],
110486
+ y: off[1],
110492
110487
  scale
110493
110488
  });
110494
110489
  }
@@ -122968,7 +122963,7 @@ class Storey {
122968
122963
  /**
122969
122964
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122970
122965
  *
122971
- * The boundary is a six-element Float32Array containing the min/max extents of the
122966
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122972
122967
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122973
122968
  *
122974
122969
  * @property storeyAABB
@@ -122979,7 +122974,7 @@ class Storey {
122979
122974
  /**
122980
122975
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122981
122976
  *
122982
- * The boundary is a six-element Float32Array containing the min/max extents of the
122977
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122983
122978
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122984
122979
  *
122985
122980
  * @deprecated
@@ -122991,7 +122986,7 @@ class Storey {
122991
122986
  /**
122992
122987
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
122993
122988
  *
122994
- * The boundary is a six-element Float32Array containing the min/max extents of the
122989
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122995
122990
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122996
122991
  *
122997
122992
  * @property modelAABB
@@ -123316,6 +123311,8 @@ class StoreyViewsPlugin extends Plugin {
123316
123311
  */
123317
123312
  this.storeys = {};
123318
123313
 
123314
+ this._storeysList = null;
123315
+
123319
123316
  /**
123320
123317
  * A set of {@link Storey}s for each {@link MetaModel}.
123321
123318
  *
@@ -123357,6 +123354,7 @@ class StoreyViewsPlugin extends Plugin {
123357
123354
  this.fire("storeys", this.storeys);
123358
123355
  });
123359
123356
  this.storeys[storeyId] = storey;
123357
+ this._storeysList= null;
123360
123358
  if (!this.modelStoreys[modelId]) {
123361
123359
  this.modelStoreys[modelId] = {};
123362
123360
  }
@@ -123377,6 +123375,7 @@ class StoreyViewsPlugin extends Plugin {
123377
123375
  model.off(storey._onModelDestroyed);
123378
123376
  }
123379
123377
  delete this.storeys[storyObjectId];
123378
+ this._storeysList= null;
123380
123379
  }
123381
123380
  }
123382
123381
  delete this.modelStoreys[modelId];
@@ -123481,7 +123480,7 @@ class StoreyViewsPlugin extends Plugin {
123481
123480
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
123482
123481
  * @param {*} [options] Options for showing the Entitys within the storey.
123483
123482
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
123484
- */
123483
+ */
123485
123484
  showStoreyObjects(storeyId, options = {}) {
123486
123485
 
123487
123486
  const storey = this.storeys[storeyId];
@@ -123506,7 +123505,7 @@ class StoreyViewsPlugin extends Plugin {
123506
123505
 
123507
123506
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
123508
123507
  if (entity) {
123509
- entity.visible = true;
123508
+ entity.visible = true;
123510
123509
  }
123511
123510
  });
123512
123511
  }
@@ -123742,7 +123741,7 @@ class StoreyViewsPlugin extends Plugin {
123742
123741
 
123743
123742
  /**
123744
123743
  * Gets the ID of the storey which's bounding box contains the y point of the world position
123745
- *
123744
+ *
123746
123745
  * @param {Number[]} worldPos 3D World-space position.
123747
123746
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
123748
123747
  */
@@ -123862,6 +123861,42 @@ class StoreyViewsPlugin extends Plugin {
123862
123861
  this.viewer.scene.off(this._onModelLoaded);
123863
123862
  super.destroy();
123864
123863
  }
123864
+
123865
+ /**
123866
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
123867
+ *
123868
+ * @returns {null}
123869
+ */
123870
+ get storeysList() {
123871
+ if (!this._storeysList) {
123872
+ this._storeysList = Object.values(this.storeys);
123873
+ this._storeysList.sort(this._getSpatialSortFunc());
123874
+ }
123875
+ return this._storeysList;
123876
+ }
123877
+
123878
+ _getSpatialSortFunc() {
123879
+ const viewer = this.viewer;
123880
+ const scene = viewer.scene;
123881
+ const camera = scene.camera;
123882
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
123883
+ let idx = 0;
123884
+ if (camera.xUp) {
123885
+ idx = 0;
123886
+ } else if (camera.yUp) {
123887
+ idx = 1;
123888
+ } else {
123889
+ idx = 2;
123890
+ }
123891
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
123892
+ return -1;
123893
+ }
123894
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
123895
+ return 1;
123896
+ }
123897
+ return 0;
123898
+ });
123899
+ }
123865
123900
  }
123866
123901
 
123867
123902
  const zeroVec = new Float64Array([0, 0, 1]);
@@ -127424,8 +127459,8 @@ class TreeViewPlugin extends Plugin {
127424
127459
  if (!children || children.length === 0) {
127425
127460
  return;
127426
127461
  }
127427
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
127428
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
127462
+ const firstChild = children[0];
127463
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
127429
127464
  children.sort(this._getSpatialSortFunc());
127430
127465
  } else {
127431
127466
  children.sort(this._alphaSortFunc);