@xeokit/xeokit-sdk 2.6.42 → 2.6.45

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 (38) hide show
  1. package/dist/xeokit-sdk.cjs.js +256 -64
  2. package/dist/xeokit-sdk.es.js +256 -64
  3. package/dist/xeokit-sdk.es5.js +127 -57
  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 +25 -2
  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 +157 -2
  13. package/src/plugins/TreeViewPlugin/RenderService.js +3 -0
  14. package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +12 -12
  15. package/src/plugins/ZonesPlugin/ZonesPlugin.js +1 -1
  16. package/src/viewer/Viewer.js +5 -1
  17. package/src/viewer/scene/input/Input.js +5 -9
  18. package/src/viewer/scene/math/rtcCoords.js +5 -1
  19. package/src/viewer/scene/model/SceneModel.js +3 -1
  20. package/src/viewer/scene/model/SceneModelMesh.js +10 -9
  21. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +1 -1
  22. package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +2 -2
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +1 -1
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +1 -1
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +1 -1
  26. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +1 -1
  27. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +1 -1
  28. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +1 -1
  29. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +1 -1
  30. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +1 -1
  31. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +1 -1
  32. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +2 -1
  33. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +1 -1
  34. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +1 -1
  35. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +1 -1
  36. package/src/viewer/scene/model/vbo/VBORenderer.js +1 -1
  37. package/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js +2 -2
  38. 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
  }
@@ -682,9 +683,8 @@ class ContextMenu {
682
683
  if (itemSubMenu) {
683
684
 
684
685
  html.push(
685
- '<li id="' + item.id + '" class="xeokit-context-menu-item">' +
686
+ '<li id="' + item.id + '" class="xeokit-context-menu-item xeokit-context-menu-submenu">' +
686
687
  actionTitle +
687
- ' [MORE]' +
688
688
  '</li>');
689
689
  if (!((groupIdx === groupLen - 1) || (j < lenj - 1))) {
690
690
  html.push(
@@ -916,6 +916,29 @@ class ContextMenu {
916
916
  }
917
917
  }
918
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
+
919
942
  _showMenu(menuId, pageX, pageY) { // Shows the given menu, at the specified page coordinates
920
943
  const menu = this._menuMap[menuId];
921
944
  if (!menu) {
@@ -1304,7 +1327,7 @@ const tempVec3a$N = new FloatArrayType(3);
1304
1327
 
1305
1328
  const tempMat1 = new FloatArrayType(16);
1306
1329
  const tempMat2 = new FloatArrayType(16);
1307
- const tempVec4$1 = new FloatArrayType(4);
1330
+ const tempVec4$2 = new FloatArrayType(4);
1308
1331
 
1309
1332
 
1310
1333
  /**
@@ -4493,7 +4516,7 @@ const math = {
4493
4516
  },
4494
4517
 
4495
4518
  quaternionToAngleAxis(q, angleAxis = math.vec4()) {
4496
- q = math.normalizeQuaternion(q, tempVec4$1);
4519
+ q = math.normalizeQuaternion(q, tempVec4$2);
4497
4520
  const q3 = q[3];
4498
4521
  const angle = 2 * Math.acos(q3);
4499
4522
  const s = Math.sqrt(1 - q3 * q3);
@@ -9777,6 +9800,7 @@ class Dot {
9777
9800
  }
9778
9801
 
9779
9802
  const tempVec3a$L = math.vec3();
9803
+ const tempVec4$1 = math.vec4();
9780
9804
 
9781
9805
  /**
9782
9806
  * Given a view matrix and a relative-to-center (RTC) coordinate origin, returns a view matrix
@@ -9905,7 +9929,10 @@ function rtcToWorldPos(rtcCenter, rtcPos, worldPos) {
9905
9929
  * @param rtcPlanePos
9906
9930
  * @returns {*}
9907
9931
  */
9908
- function getPlaneRTCPos(dist, dir, rtcCenter, rtcPlanePos) {
9932
+ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, rotationMatrixConjugate) {
9933
+ const rtcCenter = (rotationMatrixConjugate
9934
+ ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(rotationMatrixConjugate, tempVec4$1, tempVec4$1))
9935
+ : rtcOrigin);
9909
9936
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
9910
9937
  const dirNormalized = math.normalizeVec3(dir, tempVec3a$L);
9911
9938
  math.mulVec3Scalar(dirNormalized, -rtcCenterToPlaneDist, rtcPlanePos);
@@ -11353,7 +11380,7 @@ function activateDraggableDots(cfg) {
11353
11380
  };
11354
11381
  }
11355
11382
 
11356
- const touchPointSelector$1 = function(viewer, pointerCircle, ray2WorldPos) {
11383
+ const touchPointSelector = function(viewer, pointerCircle, ray2WorldPos) {
11357
11384
  return function(onCancel, onChange, onCommit) {
11358
11385
  const scene = viewer.scene;
11359
11386
  const canvas = scene.canvas.canvas;
@@ -22277,15 +22304,11 @@ class Input extends Component {
22277
22304
  this.mouseCanvasPos[1] = event.y;
22278
22305
  } else {
22279
22306
  let element = event.target;
22280
- let totalOffsetLeft = 0;
22281
- let totalOffsetTop = 0;
22282
- while (element.offsetParent) {
22283
- totalOffsetLeft += element.offsetLeft;
22284
- totalOffsetTop += element.offsetTop;
22285
- element = element.offsetParent;
22286
- }
22287
- this.mouseCanvasPos[0] = event.pageX - totalOffsetLeft;
22288
- 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;
22289
22312
  }
22290
22313
  }
22291
22314
 
@@ -51462,6 +51485,16 @@ class SceneModelMesh {
51462
51485
  */
51463
51486
  set aabb(aabb) { // Called by SceneModel
51464
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
+ }
51465
51498
  }
51466
51499
 
51467
51500
  /**
@@ -51478,15 +51511,6 @@ class SceneModelMesh {
51478
51511
  math.transformOBB3(this.model.worldMatrix, tempOBB3$1, tempOBB3b);
51479
51512
  math.OBB3ToAABB3(tempOBB3b, this._aabbWorld);
51480
51513
  }
51481
- if (this.origin) {
51482
- const origin = this.origin;
51483
- this._aabbWorld[0] += origin[0];
51484
- this._aabbWorld[1] += origin[1];
51485
- this._aabbWorld[2] += origin[2];
51486
- this._aabbWorld[3] += origin[0];
51487
- this._aabbWorld[4] += origin[1];
51488
- this._aabbWorld[5] += origin[2];
51489
- }
51490
51514
  this._aabbWorldDirty = false;
51491
51515
  }
51492
51516
  return this._aabbWorld;
@@ -51722,7 +51746,7 @@ class VBORenderer {
51722
51746
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
51723
51747
  const origin = layer._state.origin;
51724
51748
  if (origin) {
51725
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C);
51749
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.rotationMatrixConjugate);
51726
51750
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
51727
51751
  } else {
51728
51752
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -67678,7 +67702,7 @@ class VBOBatchingPointsLayer {
67678
67702
 
67679
67703
  this._renderers = getRenderers$3(cfg.model.scene);
67680
67704
 
67681
- const maxGeometryBatchSize = Math.min(5000000, cfg.maxGeometryBatchSize || window.Infinity);
67705
+ const maxGeometryBatchSize = cfg.maxGeometryBatchSize || 5000000;
67682
67706
 
67683
67707
  const attribute = function() {
67684
67708
  const portions = [ ];
@@ -67794,7 +67818,7 @@ class VBOBatchingPointsLayer {
67794
67818
  if (this._finalized) {
67795
67819
  throw "Already finalized";
67796
67820
  }
67797
- return (this._buffer.vertsIndex + (lenPositions / 3)) < this._buffer.maxVerts;
67821
+ return (this._buffer.vertsIndex + (lenPositions / 3)) <= this._buffer.maxVerts;
67798
67822
  }
67799
67823
 
67800
67824
  /**
@@ -71033,7 +71057,7 @@ class DTXLinesColorRenderer {
71033
71057
  if (active) {
71034
71058
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
71035
71059
  if (origin) {
71036
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n);
71060
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, rotationMatrixConjugate);
71037
71061
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
71038
71062
  } else {
71039
71063
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -72946,7 +72970,7 @@ class DTXTrianglesColorRenderer {
72946
72970
  if (active) {
72947
72971
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
72948
72972
  if (origin) {
72949
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m);
72973
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, rotationMatrixConjugate);
72950
72974
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
72951
72975
  } else {
72952
72976
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73580,7 +73604,7 @@ class DTXTrianglesSilhouetteRenderer {
73580
73604
  if (active) {
73581
73605
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
73582
73606
  if (origin) {
73583
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l);
73607
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, rotationMatrixConjugate);
73584
73608
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
73585
73609
  } else {
73586
73610
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74030,7 +74054,7 @@ class DTXTrianglesEdgesRenderer {
74030
74054
  if (active) {
74031
74055
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74032
74056
  if (origin) {
74033
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74057
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, rotationMatrixConjugate);
74034
74058
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74035
74059
  } else {
74036
74060
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74422,7 +74446,7 @@ class DTXTrianglesEdgesColorRenderer {
74422
74446
  if (active) {
74423
74447
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74424
74448
  if (origin) {
74425
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
74449
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, rotationMatrixConjugate);
74426
74450
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74427
74451
  } else {
74428
74452
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74843,7 +74867,7 @@ class DTXTrianglesPickMeshRenderer {
74843
74867
  if (active) {
74844
74868
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74845
74869
  if (origin) {
74846
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
74870
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, rotationMatrixConjugate);
74847
74871
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74848
74872
  } else {
74849
74873
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75290,7 +75314,7 @@ class DTXTrianglesPickDepthRenderer {
75290
75314
  if (active) {
75291
75315
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75292
75316
  if (origin) {
75293
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h);
75317
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, rotationMatrixConjugate);
75294
75318
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75295
75319
  } else {
75296
75320
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75762,7 +75786,7 @@ class DTXTrianglesSnapRenderer {
75762
75786
  if (active) {
75763
75787
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75764
75788
  if (origin) {
75765
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
75789
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, rotationMatrixConjugate);
75766
75790
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75767
75791
  } else {
75768
75792
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76187,7 +76211,7 @@ class DTXTrianglesSnapInitRenderer {
76187
76211
  if (active) {
76188
76212
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76189
76213
  if (origin) {
76190
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
76214
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, rotationMatrixConjugate);
76191
76215
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76192
76216
  } else {
76193
76217
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76636,7 +76660,7 @@ class DTXTrianglesOcclusionRenderer {
76636
76660
  if (active) {
76637
76661
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76638
76662
  if (origin) {
76639
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
76663
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, rotationMatrixConjugate);
76640
76664
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76641
76665
  } else {
76642
76666
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77039,7 +77063,7 @@ class DTXTrianglesDepthRenderer {
77039
77063
  if (active) {
77040
77064
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77041
77065
  if (origin) {
77042
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
77066
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, rotationMatrixConjugate);
77043
77067
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77044
77068
  } else {
77045
77069
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77490,7 +77514,7 @@ class DTXTrianglesNormalsRenderer {
77490
77514
  if (active) {
77491
77515
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77492
77516
  if (origin) {
77493
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
77517
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, rotationMatrixConjugate);
77494
77518
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77495
77519
  } else {
77496
77520
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77849,7 +77873,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77849
77873
  if (active) {
77850
77874
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77851
77875
  if (origin) {
77852
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
77876
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, rotationMatrixConjugate);
77853
77877
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77854
77878
  } else {
77855
77879
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -80159,14 +80183,14 @@ class DTXTrianglesLayer {
80159
80183
  // object colors
80160
80184
  textureState.texturePerObjectColorsAndFlags._textureData.set(tempUint8Array4, subPortionId * 32);
80161
80185
  if (this._deferredSetFlagsActive) {
80162
- console.info("_subPortionSetColor defer");
80186
+ //console.info("_subPortionSetColor defer");
80163
80187
  this._deferredSetFlagsDirty = true;
80164
80188
  return;
80165
80189
  }
80166
80190
  if (++this._numUpdatesInFrame >= MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE) {
80167
80191
  this._beginDeferredFlags(); // Subsequent flags updates now deferred
80168
80192
  }
80169
- console.info("_subPortionSetColor write through");
80193
+ //console.info("_subPortionSetColor write through");
80170
80194
  gl.bindTexture(gl.TEXTURE_2D, textureState.texturePerObjectColorsAndFlags._texture);
80171
80195
  gl.texSubImage2D(
80172
80196
  gl.TEXTURE_2D,
@@ -85810,6 +85834,7 @@ class SceneModel extends Component {
85810
85834
  cfg.meshMatrix = cfg.transform.worldMatrix;
85811
85835
  }
85812
85836
  mesh.portionId = mesh.layer.createPortion(mesh, cfg);
85837
+ mesh.numPrimitives = cfg.numPrimitives;
85813
85838
  this._meshes[cfg.id] = mesh;
85814
85839
  this._unusedMeshes[cfg.id] = mesh;
85815
85840
  this._meshList.push(mesh);
@@ -86173,7 +86198,7 @@ class SceneModel extends Component {
86173
86198
  flags = flags | ENTITY_FLAGS.SELECTED;
86174
86199
  }
86175
86200
  cfg.flags = flags;
86176
- this._createEntity(cfg);
86201
+ return this._createEntity(cfg);
86177
86202
  }
86178
86203
 
86179
86204
  _createEntity(cfg) {
@@ -86204,6 +86229,7 @@ class SceneModel extends Component {
86204
86229
  this._entities[cfg.id] = entity;
86205
86230
  this._entitiesToFinalize.push(entity);
86206
86231
  this.numEntities++;
86232
+ return entity;
86207
86233
  }
86208
86234
 
86209
86235
  /**
@@ -110450,10 +110476,14 @@ class Viewer {
110450
110476
 
110451
110477
  for (let i = 0, len = pluginContainerElements.length; i < len; i++) {
110452
110478
  const containerElement = pluginContainerElements[i];
110479
+ //only calculate the scale for first plugin
110480
+ //for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
110481
+ //resulting in increase/decreased size for the the canvas that is being overlapped
110482
+ const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
110453
110483
  await html2canvas(containerElement, {
110454
110484
  canvas: snapshotCanvas,
110455
110485
  backgroundColor: null,
110456
- scale: snapshotCanvas.width / containerElement.clientWidth
110486
+ scale
110457
110487
  });
110458
110488
  }
110459
110489
  if (!params.includeGizmos) {
@@ -117964,6 +117994,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
117964
117994
  entityId: options.entityId,
117965
117995
  metaModelJSON,
117966
117996
  autoMetaModel: options.autoMetaModel,
117997
+ globalizeObjectIds: options.globalizeObjectIds,
117967
117998
  metaObjects: [],
117968
117999
  loadBuffer: options.loadBuffer,
117969
118000
  basePath: options.basePath,
@@ -118292,16 +118323,17 @@ function loadDefaultScene(ctx) {
118292
118323
 
118293
118324
  if (entityId) {
118294
118325
  if (meshIds.length > 0) {
118326
+ const globalId = ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, entityId) : entityId;
118295
118327
  ctx.sceneModel.createEntity({
118296
- id: entityId,
118328
+ id: globalId,
118297
118329
  meshIds: meshIds,
118298
118330
  isObject: true
118299
118331
  });
118300
118332
  if (ctx.autoMetaModel) {
118301
118333
  ctx.metaObjects.push({
118302
- id: entityId,
118334
+ id: globalId,
118303
118335
  type: "Default",
118304
- name: entityId,
118336
+ name: globalId,
118305
118337
  parent: ctx.sceneModel.id
118306
118338
  });
118307
118339
  }
@@ -118784,6 +118816,7 @@ class GLTFLoaderPlugin extends Plugin {
118784
118816
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
118785
118817
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
118786
118818
  * @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
118819
+ * @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.
118787
118820
  * @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}
118788
118821
  */
118789
118822
  load(params = {}) {
@@ -126151,6 +126184,9 @@ class RenderService {
126151
126184
  }
126152
126185
  if (indeterminate !== checkbox.indeterminate) {
126153
126186
  checkbox.indeterminate = indeterminate;
126187
+ if (indeterminate) {
126188
+ checkbox.checked = false;
126189
+ }
126154
126190
  }
126155
126191
  }
126156
126192
  }
@@ -133334,9 +133370,9 @@ class XKTLoaderPlugin extends Plugin {
133334
133370
  globalizeObjectIds: options.globalizeObjectIds
133335
133371
  });
133336
133372
  if (params.src) {
133337
- this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);
133373
+ this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
133338
133374
  } else {
133339
- this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);
133375
+ this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
133340
133376
  finish();
133341
133377
  }
133342
133378
  }, (errMsg) => {
@@ -133350,9 +133386,9 @@ class XKTLoaderPlugin extends Plugin {
133350
133386
  globalizeObjectIds: options.globalizeObjectIds
133351
133387
  });
133352
133388
  if (params.src) {
133353
- this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);
133389
+ this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
133354
133390
  } else {
133355
- this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);
133391
+ this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
133356
133392
  finish();
133357
133393
  }
133358
133394
  }
@@ -133361,9 +133397,9 @@ class XKTLoaderPlugin extends Plugin {
133361
133397
  } else {
133362
133398
 
133363
133399
  if (params.src) {
133364
- this._loadModel(params.src, params, options, sceneModel, metaModel, manifestCtx, finish, error);
133400
+ this._loadModel(params.src, options, sceneModel, metaModel, manifestCtx, finish, error);
133365
133401
  } else if (params.xkt) {
133366
- this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
133402
+ this._parseModel(params.xkt, options, sceneModel, metaModel, manifestCtx);
133367
133403
  finish();
133368
133404
  } else if (params.manifestSrc || params.manifest) {
133369
133405
  const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
@@ -133397,7 +133433,7 @@ class XKTLoaderPlugin extends Plugin {
133397
133433
  done();
133398
133434
  } else {
133399
133435
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
133400
- this._parseModel(arrayBuffer, params, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
133436
+ this._parseModel(arrayBuffer, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
133401
133437
  sceneModel.preFinalize();
133402
133438
  i++;
133403
133439
  this.scheduleTask(loadNext, 200);
@@ -133415,7 +133451,7 @@ class XKTLoaderPlugin extends Plugin {
133415
133451
  done();
133416
133452
  } else {
133417
133453
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
133418
- this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
133454
+ this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
133419
133455
  sceneModel.preFinalize();
133420
133456
  i++;
133421
133457
  this.scheduleTask(loadNext, 200);
@@ -133465,15 +133501,15 @@ class XKTLoaderPlugin extends Plugin {
133465
133501
  return sceneModel;
133466
133502
  }
133467
133503
 
133468
- _loadModel(src, params, options, sceneModel, metaModel, manifestCtx, done, error) {
133469
- this._dataSource.getXKT(params.src, (arrayBuffer) => {
133470
- this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
133504
+ _loadModel(src, options, sceneModel, metaModel, manifestCtx, done, error) {
133505
+ this._dataSource.getXKT(src, (arrayBuffer) => {
133506
+ this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
133471
133507
  sceneModel.preFinalize();
133472
133508
  done();
133473
133509
  }, error);
133474
133510
  }
133475
133511
 
133476
- async _parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx) {
133512
+ async _parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx) {
133477
133513
  if (sceneModel.destroyed) {
133478
133514
  return;
133479
133515
  }
@@ -137697,6 +137733,10 @@ class LASLoaderPlugin extends Plugin {
137697
137733
  * @param {Number} [cfg.skip=1] Configures LASLoaderPlugin to load every **n** points.
137698
137734
  * @param {Number} [cfg.fp64=false] Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
137699
137735
  * @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".
137736
+ * @param {Boolean} [cfg.center=false] Whether to center the LAS points. Applied before "rotateX", "rotate" and "transform".
137737
+ * @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
137738
+ * @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".
137739
+ * @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".
137700
137740
  */
137701
137741
  constructor(viewer, cfg = {}) {
137702
137742
 
@@ -137706,6 +137746,10 @@ class LASLoaderPlugin extends Plugin {
137706
137746
  this.skip = cfg.skip;
137707
137747
  this.fp64 = cfg.fp64;
137708
137748
  this.colorDepth = cfg.colorDepth;
137749
+ this.center = cfg.center;
137750
+ this.rotate = cfg.rotate;
137751
+ this.rotateX = cfg.rotateX;
137752
+ this.transform = cfg.transform;
137709
137753
  }
137710
137754
 
137711
137755
  /**
@@ -137800,6 +137844,106 @@ class LASLoaderPlugin extends Plugin {
137800
137844
  this._colorDepth = value || "auto";
137801
137845
  }
137802
137846
 
137847
+ /**
137848
+ * Gets if LASLoaderPlugin immediately centers LAS positions.
137849
+ *
137850
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
137851
+ *
137852
+ * Default value is ````false````.
137853
+ *
137854
+ * @returns {Boolean} True if LASLoaderPlugin immediately centers LAS positions.
137855
+ */
137856
+ get center() {
137857
+ return this._center;
137858
+ }
137859
+
137860
+ /**
137861
+ * Configures if LASLoaderPlugin immediately centers LAS positions.
137862
+ *
137863
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
137864
+ *
137865
+ * Default value is ````false````.
137866
+ *
137867
+ * @param {Boolean} value True if LASLoaderPlugin immediately centers LAS positions.
137868
+ */
137869
+ set center(value) {
137870
+ this._center = !!value;
137871
+ }
137872
+
137873
+ /**
137874
+ * Gets the current transformation to apply to LAS positions as they are loaded.
137875
+ *
137876
+ * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
137877
+ *
137878
+ * Default value is null.
137879
+ *
137880
+ * @returns {Number[]|null} A 16-element array containing a 4x4 transformation matrix.
137881
+ */
137882
+ get transform() {
137883
+ return this._transform;
137884
+ }
137885
+
137886
+ /**
137887
+ * Sets the current transformation to apply to LAS positions as they are loaded.
137888
+ *
137889
+ * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
137890
+ *
137891
+ * Default value is null.
137892
+ *
137893
+ * @param {Number[]|null} transform A 16-element array containing a 4x4 transformation matrix.
137894
+ */
137895
+ set transform(transform) {
137896
+ this._transform = transform;
137897
+ }
137898
+
137899
+ /**
137900
+ * Gets the current rotations to apply to LAS positions as they are loaded.
137901
+ *
137902
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
137903
+ *
137904
+ * Default value is null.
137905
+ *
137906
+ * @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.
137907
+ */
137908
+ get rotate() {
137909
+ return this._rotate;
137910
+ }
137911
+
137912
+ /**
137913
+ * Sets the current rotations to apply to LAS positions as they are loaded.
137914
+ *
137915
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
137916
+ *
137917
+ * Default value is null.
137918
+ *
137919
+ * @param {Number[]|null} rotate Array of three Euler angles in degrees, for each of the X, Y and Z axis.
137920
+ */
137921
+ set rotate(rotate) {
137922
+ this._rotate = rotate;
137923
+ }
137924
+
137925
+ /**
137926
+ * Gets if LAS positions are rotated 90 degrees about X as they are loaded.
137927
+ *
137928
+ * Default value is ````false````.
137929
+ *
137930
+ * @returns {*}
137931
+ */
137932
+ get rotateX() {
137933
+ return this._rotateX;
137934
+ }
137935
+
137936
+ /**
137937
+ * Sets if LAS positions are rotated 90 degrees about X as they are loaded.
137938
+ *
137939
+ * Default value is ````false````.
137940
+ *
137941
+ * @param rotateX
137942
+ */
137943
+ set rotateX(rotateX) {
137944
+ this._rotateX = rotateX;
137945
+ }
137946
+
137803
137947
  /**
137804
137948
  * Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.
137805
137949
  *
@@ -137824,6 +137968,7 @@ class LASLoaderPlugin extends Plugin {
137824
137968
  }
137825
137969
 
137826
137970
  const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {
137971
+ maxGeometryBatchSize: MAX_VERTICES,
137827
137972
  isModel: true
137828
137973
  }));
137829
137974
 
@@ -137878,9 +138023,26 @@ class LASLoaderPlugin extends Plugin {
137878
138023
 
137879
138024
  _parseModel(arrayBuffer, params, options, sceneModel) {
137880
138025
 
137881
- function readPositions(attributesPosition) {
138026
+ const readPositions = (attributesPosition) => {
137882
138027
  const positionsValue = attributesPosition.value;
137883
- if (params.rotateX) {
138028
+ if (this._center) {
138029
+ const centerPos = math.vec3();
138030
+ const numPoints = positionsValue.length;
138031
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138032
+ centerPos[0] += positionsValue[i + 0];
138033
+ centerPos[1] += positionsValue[i + 1];
138034
+ centerPos[2] += positionsValue[i + 2];
138035
+ }
138036
+ centerPos[0] /= numPoints;
138037
+ centerPos[1] /= numPoints;
138038
+ centerPos[2] /= numPoints;
138039
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138040
+ positionsValue[i + 0] -= centerPos[0];
138041
+ positionsValue[i + 1] -= centerPos[1];
138042
+ positionsValue[i + 2] -= centerPos[2];
138043
+ }
138044
+ }
138045
+ if (this._rotateX) {
137884
138046
  if (positionsValue) {
137885
138047
  for (let i = 0, len = positionsValue.length; i < len; i += 3) {
137886
138048
  const temp = positionsValue[i + 1];
@@ -137889,8 +138051,37 @@ class LASLoaderPlugin extends Plugin {
137889
138051
  }
137890
138052
  }
137891
138053
  }
138054
+ if (this._rotate) {
138055
+ const quaternion = math.identityQuaternion();
138056
+ const mat = math.mat4();
138057
+ math.eulerToQuaternion(this._rotate, "XYZ", quaternion);
138058
+ math.quaternionToRotationMat4(quaternion, mat);
138059
+ const pos = math.vec3();
138060
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138061
+ pos[0] = positionsValue[i + 0];
138062
+ pos[1] = positionsValue[i + 1];
138063
+ pos[2] = positionsValue[i + 2];
138064
+ math.transformPoint3(mat, pos, pos);
138065
+ positionsValue[i + 0] = pos[0];
138066
+ positionsValue[i + 1] = pos[1];
138067
+ positionsValue[i + 2] = pos[2];
138068
+ }
138069
+ }
138070
+ if (this._transform) {
138071
+ const mat = math.mat4(this._transform);
138072
+ const pos = math.vec3();
138073
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138074
+ pos[0] = positionsValue[i + 0];
138075
+ pos[1] = positionsValue[i + 1];
138076
+ pos[2] = positionsValue[i + 2];
138077
+ math.transformPoint3(mat, pos, pos);
138078
+ positionsValue[i + 0] = pos[0];
138079
+ positionsValue[i + 1] = pos[1];
138080
+ positionsValue[i + 2] = pos[2];
138081
+ }
138082
+ }
137892
138083
  return positionsValue;
137893
- }
138084
+ };
137894
138085
 
137895
138086
  function readColorsAndIntensities(attributesColor, attributesIntensity) {
137896
138087
  const colors = attributesColor.value;
@@ -140148,7 +140339,8 @@ class DotBIMLoaderPlugin extends Plugin {
140148
140339
  }
140149
140340
  metaModelData.propertySets.push({
140150
140341
  id: objectId,
140151
- properties
140342
+ name: "Properties",
140343
+ properties: properties
140152
140344
  });
140153
140345
 
140154
140346
  metaModelData.metaObjects.push({
@@ -142159,7 +142351,7 @@ exports.rtcToWorldPos = rtcToWorldPos;
142159
142351
  exports.sRGBEncoding = sRGBEncoding;
142160
142352
  exports.setFrustum = setFrustum;
142161
142353
  exports.stats = stats;
142162
- exports.touchPointSelector = touchPointSelector$1;
142354
+ exports.touchPointSelector = touchPointSelector;
142163
142355
  exports.transformToNode = transformToNode;
142164
142356
  exports.utils = utils;
142165
142357
  exports.worldToRTCPos = worldToRTCPos;