@xeokit/xeokit-sdk 2.6.43 → 2.6.46

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 (51) hide show
  1. package/dist/xeokit-sdk.cjs.js +298 -99
  2. package/dist/xeokit-sdk.es.js +298 -99
  3. package/dist/xeokit-sdk.es5.js +135 -68
  4. package/dist/xeokit-sdk.min.cjs.js +5 -5
  5. package/dist/xeokit-sdk.min.es.js +5 -5
  6. package/dist/xeokit-sdk.min.es5.js +4 -4
  7. package/package.json +1 -1
  8. package/src/extras/ContextMenu/ContextMenu.js +24 -0
  9. package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +2 -1
  10. package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +1 -0
  11. package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +5 -3
  12. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +156 -2
  13. package/src/plugins/TreeViewPlugin/RenderService.js +3 -0
  14. package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +14 -16
  15. package/src/viewer/Viewer.js +5 -1
  16. package/src/viewer/scene/input/Input.js +5 -9
  17. package/src/viewer/scene/math/rtcCoords.js +5 -1
  18. package/src/viewer/scene/model/SceneModel.js +4 -2
  19. package/src/viewer/scene/model/SceneModelMesh.js +10 -9
  20. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +2 -2
  21. package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +2 -2
  22. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +2 -2
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +2 -2
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +2 -2
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +2 -2
  26. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +2 -2
  27. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +2 -2
  28. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +2 -2
  29. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +2 -2
  30. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +2 -2
  31. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +2 -1
  32. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +2 -2
  33. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +2 -2
  34. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +2 -2
  35. package/src/viewer/scene/model/vbo/VBORenderer.js +2 -2
  36. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +1 -1
  37. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +1 -1
  38. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
  39. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +1 -1
  40. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +1 -1
  41. package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +10 -6
  42. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  43. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  44. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -1
  45. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
  46. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -1
  47. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -1
  48. package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +9 -4
  49. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  50. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  51. package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +95 -5
@@ -507,6 +507,7 @@ class ContextMenu {
507
507
  this._updateItemsTitles();
508
508
  this._updateItemsEnabledStatus();
509
509
  this._showMenu(this._rootMenu.id, pageX, pageY);
510
+ this._updateSubMenuInfo();
510
511
  this._shown = true;
511
512
  this.fire("shown", {});
512
513
  }
@@ -915,6 +916,29 @@ class ContextMenu {
915
916
  }
916
917
  }
917
918
 
919
+ _updateSubMenuInfo() {
920
+ if (!this._context) return;
921
+ let itemElement, itemRect, subMenuElement, initialStyles, showOnLeft, subMenuWidth;
922
+ this._itemList.forEach((item) => {
923
+ if (item.subMenu) {
924
+ itemElement = item.itemElement;
925
+ itemRect = itemElement.getBoundingClientRect();
926
+ subMenuElement = item.subMenu.menuElement;
927
+ initialStyles = {
928
+ visibility: subMenuElement.style.visibility,
929
+ display: subMenuElement.style.display,
930
+ };
931
+ subMenuElement.style.display = "block";
932
+ subMenuElement.style.visibility = "hidden";
933
+ subMenuWidth = item.subMenu.menuElement.getBoundingClientRect().width;
934
+ subMenuElement.style.visibility = initialStyles.visibility;
935
+ subMenuElement.style.display = initialStyles.display;
936
+ showOnLeft = ((itemRect.right + subMenuWidth) > window.innerWidth);
937
+ itemElement.setAttribute("data-submenuposition", showOnLeft ? "left" : "right");
938
+ }
939
+ });
940
+ }
941
+
918
942
  _showMenu(menuId, pageX, pageY) { // Shows the given menu, at the specified page coordinates
919
943
  const menu = this._menuMap[menuId];
920
944
  if (!menu) {
@@ -1303,7 +1327,7 @@ const tempVec3a$N = new FloatArrayType(3);
1303
1327
 
1304
1328
  const tempMat1 = new FloatArrayType(16);
1305
1329
  const tempMat2 = new FloatArrayType(16);
1306
- const tempVec4$1 = new FloatArrayType(4);
1330
+ const tempVec4$2 = new FloatArrayType(4);
1307
1331
 
1308
1332
 
1309
1333
  /**
@@ -4492,7 +4516,7 @@ const math = {
4492
4516
  },
4493
4517
 
4494
4518
  quaternionToAngleAxis(q, angleAxis = math.vec4()) {
4495
- q = math.normalizeQuaternion(q, tempVec4$1);
4519
+ q = math.normalizeQuaternion(q, tempVec4$2);
4496
4520
  const q3 = q[3];
4497
4521
  const angle = 2 * Math.acos(q3);
4498
4522
  const s = Math.sqrt(1 - q3 * q3);
@@ -9776,6 +9800,7 @@ class Dot {
9776
9800
  }
9777
9801
 
9778
9802
  const tempVec3a$L = math.vec3();
9803
+ const tempVec4$1 = math.vec4();
9779
9804
 
9780
9805
  /**
9781
9806
  * Given a view matrix and a relative-to-center (RTC) coordinate origin, returns a view matrix
@@ -9904,7 +9929,10 @@ function rtcToWorldPos(rtcCenter, rtcPos, worldPos) {
9904
9929
  * @param rtcPlanePos
9905
9930
  * @returns {*}
9906
9931
  */
9907
- function getPlaneRTCPos(dist, dir, rtcCenter, rtcPlanePos) {
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))
9935
+ : rtcOrigin);
9908
9936
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
9909
9937
  const dirNormalized = math.normalizeVec3(dir, tempVec3a$L);
9910
9938
  math.mulVec3Scalar(dirNormalized, -rtcCenterToPlaneDist, rtcPlanePos);
@@ -22276,15 +22304,11 @@ class Input extends Component {
22276
22304
  this.mouseCanvasPos[1] = event.y;
22277
22305
  } else {
22278
22306
  let element = event.target;
22279
- let totalOffsetLeft = 0;
22280
- let totalOffsetTop = 0;
22281
- while (element.offsetParent) {
22282
- totalOffsetLeft += element.offsetLeft;
22283
- totalOffsetTop += element.offsetTop;
22284
- element = element.offsetParent;
22285
- }
22286
- this.mouseCanvasPos[0] = event.pageX - totalOffsetLeft;
22287
- this.mouseCanvasPos[1] = event.pageY - totalOffsetTop;
22307
+
22308
+ const rect = element.getBoundingClientRect();
22309
+
22310
+ this.mouseCanvasPos[0] = event.clientX - rect.left;
22311
+ this.mouseCanvasPos[1] = event.clientY - rect.top;
22288
22312
  }
22289
22313
  }
22290
22314
 
@@ -51461,6 +51485,16 @@ class SceneModelMesh {
51461
51485
  */
51462
51486
  set aabb(aabb) { // Called by SceneModel
51463
51487
  this._aabbLocal = aabb;
51488
+ if (this.origin) {
51489
+ this._aabbLocal = aabb.slice(0);
51490
+ const origin = this.origin;
51491
+ this._aabbLocal[0] += origin[0];
51492
+ this._aabbLocal[1] += origin[1];
51493
+ this._aabbLocal[2] += origin[2];
51494
+ this._aabbLocal[3] += origin[0];
51495
+ this._aabbLocal[4] += origin[1];
51496
+ this._aabbLocal[5] += origin[2];
51497
+ }
51464
51498
  }
51465
51499
 
51466
51500
  /**
@@ -51477,15 +51511,6 @@ class SceneModelMesh {
51477
51511
  math.transformOBB3(this.model.worldMatrix, tempOBB3$1, tempOBB3b);
51478
51512
  math.OBB3ToAABB3(tempOBB3b, this._aabbWorld);
51479
51513
  }
51480
- if (this.origin) {
51481
- const origin = this.origin;
51482
- this._aabbWorld[0] += origin[0];
51483
- this._aabbWorld[1] += origin[1];
51484
- this._aabbWorld[2] += origin[2];
51485
- this._aabbWorld[3] += origin[0];
51486
- this._aabbWorld[4] += origin[1];
51487
- this._aabbWorld[5] += origin[2];
51488
- }
51489
51514
  this._aabbWorldDirty = false;
51490
51515
  }
51491
51516
  return this._aabbWorld;
@@ -51721,7 +51746,7 @@ class VBORenderer {
51721
51746
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
51722
51747
  const origin = layer._state.origin;
51723
51748
  if (origin) {
51724
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C);
51749
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.rotationMatrix);
51725
51750
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
51726
51751
  } else {
51727
51752
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -52051,7 +52076,7 @@ class VBORenderer {
52051
52076
  let offset = 0;
52052
52077
  const mat4Size = 4 * 4;
52053
52078
 
52054
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
52079
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
52055
52080
 
52056
52081
  const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);
52057
52082
  const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);
@@ -55102,7 +55127,7 @@ class TrianglesSnapInitRenderer$1 extends VBORenderer {
55102
55127
  let offset = 0;
55103
55128
  const mat4Size = 4 * 4;
55104
55129
 
55105
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
55130
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
55106
55131
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
55107
55132
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
55108
55133
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -55411,7 +55436,7 @@ class TrianglesSnapRenderer$1 extends VBORenderer{
55411
55436
  let offset = 0;
55412
55437
  const mat4Size = 4 * 4;
55413
55438
 
55414
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
55439
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
55415
55440
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
55416
55441
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
55417
55442
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -57106,12 +57131,15 @@ class VBOBatchingTrianglesLayer {
57106
57131
  return;
57107
57132
  }
57108
57133
  const positions = portion.quantizedPositions;
57109
- const origin = state.origin;
57110
- const offsetX = origin[0] ;
57111
- const offsetY = origin[1] ;
57112
- const offsetZ = origin[2] ;
57113
- const worldPos = tempVec4a$9;
57114
57134
  const sceneModelMatrix = this.model.matrix;
57135
+ const origin = math.vec4();
57136
+ origin.set(state.origin, 0);
57137
+ origin[3] = 1;
57138
+ math.mulMat4v4(sceneModelMatrix, origin, origin);
57139
+ const offsetX = origin[0];
57140
+ const offsetY = origin[1];
57141
+ const offsetZ = origin[2];
57142
+ const worldPos = tempVec4a$9;
57115
57143
  const positionsDecodeMatrix = state.positionsDecodeMatrix;
57116
57144
  for (let i = 0, len = positions.length; i < len; i += 3) {
57117
57145
  worldPos[0] = positions[i];
@@ -57119,7 +57147,8 @@ class VBOBatchingTrianglesLayer {
57119
57147
  worldPos[2] = positions[i + 2];
57120
57148
  worldPos[3] = 1.0;
57121
57149
  math.decompressPosition(worldPos, positionsDecodeMatrix);
57122
- math.transformPoint4(sceneModelMatrix, worldPos);
57150
+ worldPos[3] = 1;
57151
+ math.mulMat4v4(sceneModelMatrix, worldPos, worldPos);
57123
57152
  worldPos[0] += offsetX;
57124
57153
  worldPos[1] += offsetY;
57125
57154
  worldPos[2] += offsetZ;
@@ -60527,7 +60556,7 @@ class TrianglesSnapInitRenderer extends VBORenderer {
60527
60556
  let offset = 0;
60528
60557
  const mat4Size = 4 * 4;
60529
60558
 
60530
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
60559
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
60531
60560
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
60532
60561
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
60533
60562
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -60864,7 +60893,7 @@ class TrianglesSnapRenderer extends VBORenderer {
60864
60893
  let offset = 0;
60865
60894
  const mat4Size = 4 * 4;
60866
60895
 
60867
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
60896
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
60868
60897
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
60869
60898
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
60870
60899
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -61843,6 +61872,7 @@ class VBOInstancingTrianglesLayer {
61843
61872
  && !!textureSet
61844
61873
  && !!textureSet.colorTexture;
61845
61874
 
61875
+
61846
61876
  if (!this.model.scene.readableGeometryEnabled) {
61847
61877
  this._state.geometry = null;
61848
61878
  }
@@ -62173,21 +62203,25 @@ class VBOInstancingTrianglesLayer {
62173
62203
  return;
62174
62204
  }
62175
62205
  const positions = geometry.positionsCompressed;
62176
- const origin = state.origin;
62206
+ const sceneModelMatrix = this.model.matrix;
62207
+ const origin = math.vec4();
62208
+ origin.set(state.origin, 0);
62209
+ origin[3] = 1;
62210
+ math.mulMat4v4(sceneModelMatrix, origin, origin);
62177
62211
  const offsetX = origin[0];
62178
62212
  const offsetY = origin[1];
62179
62213
  const offsetZ = origin[2];
62180
62214
  const worldPos = tempVec4a$8;
62181
62215
  const portionMatrix = portion.matrix;
62182
- const sceneModelMatrix = this.model.matrix;
62183
62216
  const positionsDecodeMatrix = state.positionsDecodeMatrix;
62184
62217
  for (let i = 0, len = positions.length; i < len; i += 3) {
62185
62218
  worldPos[0] = positions[i];
62186
62219
  worldPos[1] = positions[i + 1];
62187
62220
  worldPos[2] = positions[i + 2];
62188
62221
  math.decompressPosition(worldPos, positionsDecodeMatrix);
62189
- math.transformPoint3(portionMatrix, worldPos);
62190
- math.transformPoint3(sceneModelMatrix, worldPos);
62222
+ math.transformPoint3(portionMatrix, worldPos, worldPos);
62223
+ worldPos[3] = 1;
62224
+ math.mulMat4v4(sceneModelMatrix, worldPos, worldPos);
62191
62225
  worldPos[0] += offsetX;
62192
62226
  worldPos[1] += offsetY;
62193
62227
  worldPos[2] += offsetZ;
@@ -63044,7 +63078,7 @@ class VBOBatchingLinesSnapInitRenderer extends VBORenderer {
63044
63078
  let offset = 0;
63045
63079
  const mat4Size = 4 * 4;
63046
63080
 
63047
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
63081
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
63048
63082
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
63049
63083
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
63050
63084
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -63353,7 +63387,7 @@ class VBOBatchingLinesSnapRenderer extends VBORenderer{
63353
63387
  let offset = 0;
63354
63388
  const mat4Size = 4 * 4;
63355
63389
 
63356
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
63390
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
63357
63391
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
63358
63392
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
63359
63393
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -64755,7 +64789,7 @@ class VBOInstancingLinesSnapInitRenderer extends VBORenderer {
64755
64789
  let offset = 0;
64756
64790
  const mat4Size = 4 * 4;
64757
64791
 
64758
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
64792
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
64759
64793
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
64760
64794
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
64761
64795
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -65081,7 +65115,7 @@ class VBOInstancingLinesSnapRenderer extends VBORenderer {
65081
65115
  let offset = 0;
65082
65116
  const mat4Size = 4 * 4;
65083
65117
 
65084
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
65118
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
65085
65119
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
65086
65120
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
65087
65121
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -66997,7 +67031,7 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
66997
67031
  let offset = 0;
66998
67032
  const mat4Size = 4 * 4;
66999
67033
 
67000
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
67034
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
67001
67035
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
67002
67036
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
67003
67037
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -67304,7 +67338,7 @@ class VBOBatchingPointsSnapRenderer extends VBORenderer{
67304
67338
  let offset = 0;
67305
67339
  const mat4Size = 4 * 4;
67306
67340
 
67307
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
67341
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
67308
67342
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
67309
67343
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
67310
67344
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -69498,7 +69532,7 @@ class VBOInstancingPointsSnapInitRenderer extends VBORenderer {
69498
69532
  let offset = 0;
69499
69533
  const mat4Size = 4 * 4;
69500
69534
 
69501
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
69535
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
69502
69536
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
69503
69537
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
69504
69538
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -69823,7 +69857,7 @@ class VBOInstancingPointsSnapRenderer extends VBORenderer {
69823
69857
  let offset = 0;
69824
69858
  const mat4Size = 4 * 4;
69825
69859
 
69826
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
69860
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
69827
69861
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
69828
69862
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
69829
69863
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -71007,7 +71041,7 @@ class DTXLinesColorRenderer {
71007
71041
  rtcViewMatrix = viewMatrix;
71008
71042
  }
71009
71043
 
71010
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
71044
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
71011
71045
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
71012
71046
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
71013
71047
  gl.uniform1i(this._uRenderPass, renderPass);
@@ -71032,7 +71066,7 @@ class DTXLinesColorRenderer {
71032
71066
  if (active) {
71033
71067
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
71034
71068
  if (origin) {
71035
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n);
71069
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, rotationMatrix);
71036
71070
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
71037
71071
  } else {
71038
71072
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -72919,7 +72953,7 @@ class DTXTrianglesColorRenderer {
72919
72953
  rtcCameraEye = camera.eye;
72920
72954
  }
72921
72955
 
72922
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
72956
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
72923
72957
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
72924
72958
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
72925
72959
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -72945,7 +72979,7 @@ class DTXTrianglesColorRenderer {
72945
72979
  if (active) {
72946
72980
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
72947
72981
  if (origin) {
72948
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m);
72982
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, rotationMatrix);
72949
72983
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
72950
72984
  } else {
72951
72985
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73535,7 +73569,7 @@ class DTXTrianglesSilhouetteRenderer {
73535
73569
 
73536
73570
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
73537
73571
  gl.uniform1i(this._uRenderPass, renderPass);
73538
- gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);
73572
+ gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrix);
73539
73573
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
73540
73574
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
73541
73575
 
@@ -73579,7 +73613,7 @@ class DTXTrianglesSilhouetteRenderer {
73579
73613
  if (active) {
73580
73614
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
73581
73615
  if (origin) {
73582
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l);
73616
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, rotationMatrix);
73583
73617
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
73584
73618
  } else {
73585
73619
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73988,7 +74022,7 @@ class DTXTrianglesEdgesRenderer {
73988
74022
  }
73989
74023
 
73990
74024
  gl.uniform1i(this._uRenderPass, renderPass);
73991
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
74025
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
73992
74026
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
73993
74027
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
73994
74028
 
@@ -74029,7 +74063,7 @@ class DTXTrianglesEdgesRenderer {
74029
74063
  if (active) {
74030
74064
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74031
74065
  if (origin) {
74032
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74066
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, rotationMatrix);
74033
74067
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74034
74068
  } else {
74035
74069
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74402,7 +74436,7 @@ class DTXTrianglesEdgesColorRenderer {
74402
74436
  }
74403
74437
 
74404
74438
  gl.uniform1i(this._uRenderPass, renderPass);
74405
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
74439
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
74406
74440
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
74407
74441
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
74408
74442
 
@@ -74421,7 +74455,7 @@ class DTXTrianglesEdgesColorRenderer {
74421
74455
  if (active) {
74422
74456
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74423
74457
  if (origin) {
74424
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
74458
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, rotationMatrix);
74425
74459
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74426
74460
  } else {
74427
74461
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74818,7 +74852,7 @@ class DTXTrianglesPickMeshRenderer {
74818
74852
  }
74819
74853
  gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
74820
74854
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
74821
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
74855
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
74822
74856
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
74823
74857
  gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
74824
74858
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -74842,7 +74876,7 @@ class DTXTrianglesPickMeshRenderer {
74842
74876
  if (active) {
74843
74877
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74844
74878
  if (origin) {
74845
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
74879
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, rotationMatrix);
74846
74880
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74847
74881
  } else {
74848
74882
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75266,7 +75300,7 @@ class DTXTrianglesPickDepthRenderer {
75266
75300
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
75267
75301
  gl.uniform1f(this._uPickZNear, frameCtx.pickZNear);
75268
75302
  gl.uniform1f(this._uPickZFar, frameCtx.pickZFar);
75269
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
75303
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
75270
75304
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
75271
75305
  gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
75272
75306
  if (scene.logarithmicDepthBufferEnabled) {
@@ -75289,7 +75323,7 @@ class DTXTrianglesPickDepthRenderer {
75289
75323
  if (active) {
75290
75324
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75291
75325
  if (origin) {
75292
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h);
75326
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, rotationMatrix);
75293
75327
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75294
75328
  } else {
75295
75329
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75739,7 +75773,7 @@ class DTXTrianglesSnapRenderer {
75739
75773
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
75740
75774
  gl.uniform1i(this._uRenderPass, renderPass);
75741
75775
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
75742
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
75776
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
75743
75777
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
75744
75778
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
75745
75779
  {
@@ -75761,7 +75795,7 @@ class DTXTrianglesSnapRenderer {
75761
75795
  if (active) {
75762
75796
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75763
75797
  if (origin) {
75764
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
75798
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, rotationMatrix);
75765
75799
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75766
75800
  } else {
75767
75801
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76164,7 +76198,7 @@ class DTXTrianglesSnapInitRenderer {
76164
76198
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
76165
76199
  gl.uniform1i(this._uRenderPass, renderPass);
76166
76200
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
76167
- gl.uniformMatrix4fv(this._uSceneWorldModelMatrix, false, rotationMatrixConjugate);
76201
+ gl.uniformMatrix4fv(this._uSceneWorldModelMatrix, false, rotationMatrix);
76168
76202
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
76169
76203
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
76170
76204
  {
@@ -76186,7 +76220,7 @@ class DTXTrianglesSnapInitRenderer {
76186
76220
  if (active) {
76187
76221
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76188
76222
  if (origin) {
76189
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
76223
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, rotationMatrix);
76190
76224
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76191
76225
  } else {
76192
76226
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76615,7 +76649,7 @@ class DTXTrianglesOcclusionRenderer {
76615
76649
 
76616
76650
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
76617
76651
  gl.uniform1i(this._uRenderPass, renderPass);
76618
- gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);
76652
+ gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrix);
76619
76653
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
76620
76654
 
76621
76655
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
@@ -76635,7 +76669,7 @@ class DTXTrianglesOcclusionRenderer {
76635
76669
  if (active) {
76636
76670
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76637
76671
  if (origin) {
76638
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
76672
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, rotationMatrix);
76639
76673
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76640
76674
  } else {
76641
76675
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77012,7 +77046,7 @@ class DTXTrianglesDepthRenderer {
77012
77046
  rtcCameraEye = camera.eye;
77013
77047
  }
77014
77048
 
77015
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
77049
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
77016
77050
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
77017
77051
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
77018
77052
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -77038,7 +77072,7 @@ class DTXTrianglesDepthRenderer {
77038
77072
  if (active) {
77039
77073
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77040
77074
  if (origin) {
77041
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
77075
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, rotationMatrix);
77042
77076
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77043
77077
  } else {
77044
77078
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77467,7 +77501,7 @@ class DTXTrianglesNormalsRenderer {
77467
77501
 
77468
77502
  gl.uniform1i(this._uRenderPass, renderPass);
77469
77503
 
77470
- gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);
77504
+ gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrix);
77471
77505
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
77472
77506
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
77473
77507
 
@@ -77489,7 +77523,7 @@ class DTXTrianglesNormalsRenderer {
77489
77523
  if (active) {
77490
77524
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77491
77525
  if (origin) {
77492
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
77526
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, rotationMatrix);
77493
77527
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77494
77528
  } else {
77495
77529
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77824,7 +77858,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77824
77858
  }
77825
77859
  gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
77826
77860
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
77827
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
77861
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
77828
77862
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
77829
77863
  gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
77830
77864
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -77848,7 +77882,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77848
77882
  if (active) {
77849
77883
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77850
77884
  if (origin) {
77851
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
77885
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, rotationMatrix);
77852
77886
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77853
77887
  } else {
77854
77888
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -80458,8 +80492,8 @@ class DTXTrianglesLayer {
80458
80492
  worldPos[2] = positions[i + 2];
80459
80493
  worldPos[3] = 1.0;
80460
80494
  math.decompressPosition(worldPos, positionsDecodeMatrix);
80461
- math.transformPoint4(this.model.worldMatrix, worldPos);
80462
- math.transformPoint4(this.model.worldMatrix, worldPos);
80495
+ math.transformPoint4(this.model.worldMatrix, worldPos, worldPos);
80496
+ math.transformPoint4(this.model.worldMatrix, worldPos, worldPos);
80463
80497
  worldPos[0] += offsetX;
80464
80498
  worldPos[1] += offsetY;
80465
80499
  worldPos[2] += offsetZ;
@@ -84285,7 +84319,7 @@ class SceneModel extends Component {
84285
84319
  if (this._matrixDirty) {
84286
84320
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84287
84321
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84288
- math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);
84322
+ math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84289
84323
  this._matrix.set(this._worldRotationMatrix);
84290
84324
  math.translateMat4v(this._position, this._matrix);
84291
84325
  this._matrixDirty = false;
@@ -85809,6 +85843,7 @@ class SceneModel extends Component {
85809
85843
  cfg.meshMatrix = cfg.transform.worldMatrix;
85810
85844
  }
85811
85845
  mesh.portionId = mesh.layer.createPortion(mesh, cfg);
85846
+ mesh.numPrimitives = cfg.numPrimitives;
85812
85847
  this._meshes[cfg.id] = mesh;
85813
85848
  this._unusedMeshes[cfg.id] = mesh;
85814
85849
  this._meshList.push(mesh);
@@ -86172,7 +86207,7 @@ class SceneModel extends Component {
86172
86207
  flags = flags | ENTITY_FLAGS.SELECTED;
86173
86208
  }
86174
86209
  cfg.flags = flags;
86175
- this._createEntity(cfg);
86210
+ return this._createEntity(cfg);
86176
86211
  }
86177
86212
 
86178
86213
  _createEntity(cfg) {
@@ -86203,6 +86238,7 @@ class SceneModel extends Component {
86203
86238
  this._entities[cfg.id] = entity;
86204
86239
  this._entitiesToFinalize.push(entity);
86205
86240
  this.numEntities++;
86241
+ return entity;
86206
86242
  }
86207
86243
 
86208
86244
  /**
@@ -110449,10 +110485,14 @@ class Viewer {
110449
110485
 
110450
110486
  for (let i = 0, len = pluginContainerElements.length; i < len; i++) {
110451
110487
  const containerElement = pluginContainerElements[i];
110488
+ //only calculate the scale for first plugin
110489
+ //for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
110490
+ //resulting in increase/decreased size for the the canvas that is being overlapped
110491
+ const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
110452
110492
  await html2canvas(containerElement, {
110453
110493
  canvas: snapshotCanvas,
110454
110494
  backgroundColor: null,
110455
- scale: snapshotCanvas.width / containerElement.clientWidth
110495
+ scale
110456
110496
  });
110457
110497
  }
110458
110498
  if (!params.includeGizmos) {
@@ -117963,6 +118003,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
117963
118003
  entityId: options.entityId,
117964
118004
  metaModelJSON,
117965
118005
  autoMetaModel: options.autoMetaModel,
118006
+ globalizeObjectIds: options.globalizeObjectIds,
117966
118007
  metaObjects: [],
117967
118008
  loadBuffer: options.loadBuffer,
117968
118009
  basePath: options.basePath,
@@ -118291,16 +118332,17 @@ function loadDefaultScene(ctx) {
118291
118332
 
118292
118333
  if (entityId) {
118293
118334
  if (meshIds.length > 0) {
118335
+ const globalId = ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, entityId) : entityId;
118294
118336
  ctx.sceneModel.createEntity({
118295
- id: entityId,
118337
+ id: globalId,
118296
118338
  meshIds: meshIds,
118297
118339
  isObject: true
118298
118340
  });
118299
118341
  if (ctx.autoMetaModel) {
118300
118342
  ctx.metaObjects.push({
118301
- id: entityId,
118343
+ id: globalId,
118302
118344
  type: "Default",
118303
- name: entityId,
118345
+ name: globalId,
118304
118346
  parent: ctx.sceneModel.id
118305
118347
  });
118306
118348
  }
@@ -118783,6 +118825,7 @@ class GLTFLoaderPlugin extends Plugin {
118783
118825
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
118784
118826
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
118785
118827
  * @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
118828
+ * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
118786
118829
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
118787
118830
  */
118788
118831
  load(params = {}) {
@@ -126150,6 +126193,9 @@ class RenderService {
126150
126193
  }
126151
126194
  if (indeterminate !== checkbox.indeterminate) {
126152
126195
  checkbox.indeterminate = indeterminate;
126196
+ if (indeterminate) {
126197
+ checkbox.checked = false;
126198
+ }
126153
126199
  }
126154
126200
  }
126155
126201
  }
@@ -133231,10 +133277,8 @@ class XKTLoaderPlugin extends Plugin {
133231
133277
  delete params.id;
133232
133278
  }
133233
133279
 
133234
- if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
133235
- this.error("load() param expected: src, xkt, manifestSrc or manifestData");
133236
- return sceneModel; // Return new empty model
133237
- }
133280
+ if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest)
133281
+ throw new Error("XKTLoaderPlugin: load() param expected: src, xkt, manifestSrc or manifestData");
133238
133282
 
133239
133283
  const options = {};
133240
133284
  const includeTypes = params.includeTypes || this._includeTypes;
@@ -133333,9 +133377,9 @@ class XKTLoaderPlugin extends Plugin {
133333
133377
  globalizeObjectIds: options.globalizeObjectIds
133334
133378
  });
133335
133379
  if (params.src) {
133336
- this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);
133380
+ this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
133337
133381
  } else {
133338
- this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);
133382
+ this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
133339
133383
  finish();
133340
133384
  }
133341
133385
  }, (errMsg) => {
@@ -133349,9 +133393,9 @@ class XKTLoaderPlugin extends Plugin {
133349
133393
  globalizeObjectIds: options.globalizeObjectIds
133350
133394
  });
133351
133395
  if (params.src) {
133352
- this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);
133396
+ this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
133353
133397
  } else {
133354
- this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);
133398
+ this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
133355
133399
  finish();
133356
133400
  }
133357
133401
  }
@@ -133360,9 +133404,9 @@ class XKTLoaderPlugin extends Plugin {
133360
133404
  } else {
133361
133405
 
133362
133406
  if (params.src) {
133363
- this._loadModel(params.src, params, options, sceneModel, metaModel, manifestCtx, finish, error);
133407
+ this._loadModel(params.src, options, sceneModel, metaModel, manifestCtx, finish, error);
133364
133408
  } else if (params.xkt) {
133365
- this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
133409
+ this._parseModel(params.xkt, options, sceneModel, metaModel, manifestCtx);
133366
133410
  finish();
133367
133411
  } else if (params.manifestSrc || params.manifest) {
133368
133412
  const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
@@ -133396,7 +133440,7 @@ class XKTLoaderPlugin extends Plugin {
133396
133440
  done();
133397
133441
  } else {
133398
133442
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
133399
- this._parseModel(arrayBuffer, params, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
133443
+ this._parseModel(arrayBuffer, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
133400
133444
  sceneModel.preFinalize();
133401
133445
  i++;
133402
133446
  this.scheduleTask(loadNext, 200);
@@ -133414,7 +133458,7 @@ class XKTLoaderPlugin extends Plugin {
133414
133458
  done();
133415
133459
  } else {
133416
133460
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
133417
- this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
133461
+ this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
133418
133462
  sceneModel.preFinalize();
133419
133463
  i++;
133420
133464
  this.scheduleTask(loadNext, 200);
@@ -133464,15 +133508,15 @@ class XKTLoaderPlugin extends Plugin {
133464
133508
  return sceneModel;
133465
133509
  }
133466
133510
 
133467
- _loadModel(src, params, options, sceneModel, metaModel, manifestCtx, done, error) {
133468
- this._dataSource.getXKT(params.src, (arrayBuffer) => {
133469
- this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
133511
+ _loadModel(src, options, sceneModel, metaModel, manifestCtx, done, error) {
133512
+ this._dataSource.getXKT(src, (arrayBuffer) => {
133513
+ this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
133470
133514
  sceneModel.preFinalize();
133471
133515
  done();
133472
133516
  }, error);
133473
133517
  }
133474
133518
 
133475
- async _parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx) {
133519
+ async _parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx) {
133476
133520
  if (sceneModel.destroyed) {
133477
133521
  return;
133478
133522
  }
@@ -137696,6 +137740,10 @@ class LASLoaderPlugin extends Plugin {
137696
137740
  * @param {Number} [cfg.skip=1] Configures LASLoaderPlugin to load every **n** points.
137697
137741
  * @param {Number} [cfg.fp64=false] Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
137698
137742
  * @param {Number} [cfg.colorDepth=8] Configures whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits. Accepted values are 8, 16 an "auto".
137743
+ * @param {Boolean} [cfg.center=false] Whether to center the LAS points. Applied before "rotateX", "rotate" and "transform".
137744
+ * @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
137745
+ * @param {Number[]} [cfg.rotate=[0,0,0]] Rotations to immediately apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".
137746
+ * @param {Number[]} [cfg.transform] 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate".
137699
137747
  */
137700
137748
  constructor(viewer, cfg = {}) {
137701
137749
 
@@ -137705,6 +137753,10 @@ class LASLoaderPlugin extends Plugin {
137705
137753
  this.skip = cfg.skip;
137706
137754
  this.fp64 = cfg.fp64;
137707
137755
  this.colorDepth = cfg.colorDepth;
137756
+ this.center = cfg.center;
137757
+ this.rotate = cfg.rotate;
137758
+ this.rotateX = cfg.rotateX;
137759
+ this.transform = cfg.transform;
137708
137760
  }
137709
137761
 
137710
137762
  /**
@@ -137799,6 +137851,106 @@ class LASLoaderPlugin extends Plugin {
137799
137851
  this._colorDepth = value || "auto";
137800
137852
  }
137801
137853
 
137854
+ /**
137855
+ * Gets if LASLoaderPlugin immediately centers LAS positions.
137856
+ *
137857
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
137858
+ *
137859
+ * Default value is ````false````.
137860
+ *
137861
+ * @returns {Boolean} True if LASLoaderPlugin immediately centers LAS positions.
137862
+ */
137863
+ get center() {
137864
+ return this._center;
137865
+ }
137866
+
137867
+ /**
137868
+ * Configures if LASLoaderPlugin immediately centers LAS positions.
137869
+ *
137870
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
137871
+ *
137872
+ * Default value is ````false````.
137873
+ *
137874
+ * @param {Boolean} value True if LASLoaderPlugin immediately centers LAS positions.
137875
+ */
137876
+ set center(value) {
137877
+ this._center = !!value;
137878
+ }
137879
+
137880
+ /**
137881
+ * Gets the current transformation to apply to LAS positions as they are loaded.
137882
+ *
137883
+ * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
137884
+ *
137885
+ * Default value is null.
137886
+ *
137887
+ * @returns {Number[]|null} A 16-element array containing a 4x4 transformation matrix.
137888
+ */
137889
+ get transform() {
137890
+ return this._transform;
137891
+ }
137892
+
137893
+ /**
137894
+ * Sets the current transformation to apply to LAS positions as they are loaded.
137895
+ *
137896
+ * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
137897
+ *
137898
+ * Default value is null.
137899
+ *
137900
+ * @param {Number[]|null} transform A 16-element array containing a 4x4 transformation matrix.
137901
+ */
137902
+ set transform(transform) {
137903
+ this._transform = transform;
137904
+ }
137905
+
137906
+ /**
137907
+ * Gets the current rotations to apply to LAS positions as they are loaded.
137908
+ *
137909
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
137910
+ *
137911
+ * Default value is null.
137912
+ *
137913
+ * @returns {Number[]|null} If defined, an array of three Euler angles in degrees, for each of the X, Y and Z axis. Null if undefined.
137914
+ */
137915
+ get rotate() {
137916
+ return this._rotate;
137917
+ }
137918
+
137919
+ /**
137920
+ * Sets the current rotations to apply to LAS positions as they are loaded.
137921
+ *
137922
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
137923
+ *
137924
+ * Default value is null.
137925
+ *
137926
+ * @param {Number[]|null} rotate Array of three Euler angles in degrees, for each of the X, Y and Z axis.
137927
+ */
137928
+ set rotate(rotate) {
137929
+ this._rotate = rotate;
137930
+ }
137931
+
137932
+ /**
137933
+ * Gets if LAS positions are rotated 90 degrees about X as they are loaded.
137934
+ *
137935
+ * Default value is ````false````.
137936
+ *
137937
+ * @returns {*}
137938
+ */
137939
+ get rotateX() {
137940
+ return this._rotateX;
137941
+ }
137942
+
137943
+ /**
137944
+ * Sets if LAS positions are rotated 90 degrees about X as they are loaded.
137945
+ *
137946
+ * Default value is ````false````.
137947
+ *
137948
+ * @param rotateX
137949
+ */
137950
+ set rotateX(rotateX) {
137951
+ this._rotateX = rotateX;
137952
+ }
137953
+
137802
137954
  /**
137803
137955
  * Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.
137804
137956
  *
@@ -137878,9 +138030,26 @@ class LASLoaderPlugin extends Plugin {
137878
138030
 
137879
138031
  _parseModel(arrayBuffer, params, options, sceneModel) {
137880
138032
 
137881
- function readPositions(attributesPosition) {
138033
+ const readPositions = (attributesPosition) => {
137882
138034
  const positionsValue = attributesPosition.value;
137883
- if (params.rotateX) {
138035
+ if (this._center) {
138036
+ const centerPos = math.vec3();
138037
+ const numPoints = positionsValue.length;
138038
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138039
+ centerPos[0] += positionsValue[i + 0];
138040
+ centerPos[1] += positionsValue[i + 1];
138041
+ centerPos[2] += positionsValue[i + 2];
138042
+ }
138043
+ centerPos[0] /= numPoints;
138044
+ centerPos[1] /= numPoints;
138045
+ centerPos[2] /= numPoints;
138046
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138047
+ positionsValue[i + 0] -= centerPos[0];
138048
+ positionsValue[i + 1] -= centerPos[1];
138049
+ positionsValue[i + 2] -= centerPos[2];
138050
+ }
138051
+ }
138052
+ if (this._rotateX) {
137884
138053
  if (positionsValue) {
137885
138054
  for (let i = 0, len = positionsValue.length; i < len; i += 3) {
137886
138055
  const temp = positionsValue[i + 1];
@@ -137889,8 +138058,37 @@ class LASLoaderPlugin extends Plugin {
137889
138058
  }
137890
138059
  }
137891
138060
  }
138061
+ if (this._rotate) {
138062
+ const quaternion = math.identityQuaternion();
138063
+ const mat = math.mat4();
138064
+ math.eulerToQuaternion(this._rotate, "XYZ", quaternion);
138065
+ math.quaternionToRotationMat4(quaternion, mat);
138066
+ const pos = math.vec3();
138067
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138068
+ pos[0] = positionsValue[i + 0];
138069
+ pos[1] = positionsValue[i + 1];
138070
+ pos[2] = positionsValue[i + 2];
138071
+ math.transformPoint3(mat, pos, pos);
138072
+ positionsValue[i + 0] = pos[0];
138073
+ positionsValue[i + 1] = pos[1];
138074
+ positionsValue[i + 2] = pos[2];
138075
+ }
138076
+ }
138077
+ if (this._transform) {
138078
+ const mat = math.mat4(this._transform);
138079
+ const pos = math.vec3();
138080
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138081
+ pos[0] = positionsValue[i + 0];
138082
+ pos[1] = positionsValue[i + 1];
138083
+ pos[2] = positionsValue[i + 2];
138084
+ math.transformPoint3(mat, pos, pos);
138085
+ positionsValue[i + 0] = pos[0];
138086
+ positionsValue[i + 1] = pos[1];
138087
+ positionsValue[i + 2] = pos[2];
138088
+ }
138089
+ }
137892
138090
  return positionsValue;
137893
- }
138091
+ };
137894
138092
 
137895
138093
  function readColorsAndIntensities(attributesColor, attributesIntensity) {
137896
138094
  const colors = attributesColor.value;
@@ -140148,7 +140346,8 @@ class DotBIMLoaderPlugin extends Plugin {
140148
140346
  }
140149
140347
  metaModelData.propertySets.push({
140150
140348
  id: objectId,
140151
- properties
140349
+ name: "Properties",
140350
+ properties: properties
140152
140351
  });
140153
140352
 
140154
140353
  metaModelData.metaObjects.push({