@xeokit/xeokit-sdk 2.6.43 → 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 (35) hide show
  1. package/dist/xeokit-sdk.cjs.js +248 -56
  2. package/dist/xeokit-sdk.es.js +248 -56
  3. package/dist/xeokit-sdk.es5.js +117 -49
  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 +12 -12
  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 +3 -1
  19. package/src/viewer/scene/model/SceneModelMesh.js +10 -9
  20. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +1 -1
  21. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +1 -1
  22. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +1 -1
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +1 -1
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +1 -1
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +1 -1
  26. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +1 -1
  27. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +1 -1
  28. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +1 -1
  29. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +1 -1
  30. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +2 -1
  31. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +1 -1
  32. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +1 -1
  33. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +1 -1
  34. package/src/viewer/scene/model/vbo/VBORenderer.js +1 -1
  35. package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +95 -5
@@ -503,6 +503,7 @@ class ContextMenu {
503
503
  this._updateItemsTitles();
504
504
  this._updateItemsEnabledStatus();
505
505
  this._showMenu(this._rootMenu.id, pageX, pageY);
506
+ this._updateSubMenuInfo();
506
507
  this._shown = true;
507
508
  this.fire("shown", {});
508
509
  }
@@ -911,6 +912,29 @@ class ContextMenu {
911
912
  }
912
913
  }
913
914
 
915
+ _updateSubMenuInfo() {
916
+ if (!this._context) return;
917
+ let itemElement, itemRect, subMenuElement, initialStyles, showOnLeft, subMenuWidth;
918
+ this._itemList.forEach((item) => {
919
+ if (item.subMenu) {
920
+ itemElement = item.itemElement;
921
+ itemRect = itemElement.getBoundingClientRect();
922
+ subMenuElement = item.subMenu.menuElement;
923
+ initialStyles = {
924
+ visibility: subMenuElement.style.visibility,
925
+ display: subMenuElement.style.display,
926
+ };
927
+ subMenuElement.style.display = "block";
928
+ subMenuElement.style.visibility = "hidden";
929
+ subMenuWidth = item.subMenu.menuElement.getBoundingClientRect().width;
930
+ subMenuElement.style.visibility = initialStyles.visibility;
931
+ subMenuElement.style.display = initialStyles.display;
932
+ showOnLeft = ((itemRect.right + subMenuWidth) > window.innerWidth);
933
+ itemElement.setAttribute("data-submenuposition", showOnLeft ? "left" : "right");
934
+ }
935
+ });
936
+ }
937
+
914
938
  _showMenu(menuId, pageX, pageY) { // Shows the given menu, at the specified page coordinates
915
939
  const menu = this._menuMap[menuId];
916
940
  if (!menu) {
@@ -1299,7 +1323,7 @@ const tempVec3a$N = new FloatArrayType(3);
1299
1323
 
1300
1324
  const tempMat1 = new FloatArrayType(16);
1301
1325
  const tempMat2 = new FloatArrayType(16);
1302
- const tempVec4$1 = new FloatArrayType(4);
1326
+ const tempVec4$2 = new FloatArrayType(4);
1303
1327
 
1304
1328
 
1305
1329
  /**
@@ -4488,7 +4512,7 @@ const math = {
4488
4512
  },
4489
4513
 
4490
4514
  quaternionToAngleAxis(q, angleAxis = math.vec4()) {
4491
- q = math.normalizeQuaternion(q, tempVec4$1);
4515
+ q = math.normalizeQuaternion(q, tempVec4$2);
4492
4516
  const q3 = q[3];
4493
4517
  const angle = 2 * Math.acos(q3);
4494
4518
  const s = Math.sqrt(1 - q3 * q3);
@@ -9772,6 +9796,7 @@ class Dot {
9772
9796
  }
9773
9797
 
9774
9798
  const tempVec3a$L = math.vec3();
9799
+ const tempVec4$1 = math.vec4();
9775
9800
 
9776
9801
  /**
9777
9802
  * Given a view matrix and a relative-to-center (RTC) coordinate origin, returns a view matrix
@@ -9900,7 +9925,10 @@ function rtcToWorldPos(rtcCenter, rtcPos, worldPos) {
9900
9925
  * @param rtcPlanePos
9901
9926
  * @returns {*}
9902
9927
  */
9903
- function getPlaneRTCPos(dist, dir, rtcCenter, rtcPlanePos) {
9928
+ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, rotationMatrixConjugate) {
9929
+ const rtcCenter = (rotationMatrixConjugate
9930
+ ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(rotationMatrixConjugate, tempVec4$1, tempVec4$1))
9931
+ : rtcOrigin);
9904
9932
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
9905
9933
  const dirNormalized = math.normalizeVec3(dir, tempVec3a$L);
9906
9934
  math.mulVec3Scalar(dirNormalized, -rtcCenterToPlaneDist, rtcPlanePos);
@@ -22272,15 +22300,11 @@ class Input extends Component {
22272
22300
  this.mouseCanvasPos[1] = event.y;
22273
22301
  } else {
22274
22302
  let element = event.target;
22275
- let totalOffsetLeft = 0;
22276
- let totalOffsetTop = 0;
22277
- while (element.offsetParent) {
22278
- totalOffsetLeft += element.offsetLeft;
22279
- totalOffsetTop += element.offsetTop;
22280
- element = element.offsetParent;
22281
- }
22282
- this.mouseCanvasPos[0] = event.pageX - totalOffsetLeft;
22283
- this.mouseCanvasPos[1] = event.pageY - totalOffsetTop;
22303
+
22304
+ const rect = element.getBoundingClientRect();
22305
+
22306
+ this.mouseCanvasPos[0] = event.clientX - rect.left;
22307
+ this.mouseCanvasPos[1] = event.clientY - rect.top;
22284
22308
  }
22285
22309
  }
22286
22310
 
@@ -51457,6 +51481,16 @@ class SceneModelMesh {
51457
51481
  */
51458
51482
  set aabb(aabb) { // Called by SceneModel
51459
51483
  this._aabbLocal = aabb;
51484
+ if (this.origin) {
51485
+ this._aabbLocal = aabb.slice(0);
51486
+ const origin = this.origin;
51487
+ this._aabbLocal[0] += origin[0];
51488
+ this._aabbLocal[1] += origin[1];
51489
+ this._aabbLocal[2] += origin[2];
51490
+ this._aabbLocal[3] += origin[0];
51491
+ this._aabbLocal[4] += origin[1];
51492
+ this._aabbLocal[5] += origin[2];
51493
+ }
51460
51494
  }
51461
51495
 
51462
51496
  /**
@@ -51473,15 +51507,6 @@ class SceneModelMesh {
51473
51507
  math.transformOBB3(this.model.worldMatrix, tempOBB3$1, tempOBB3b);
51474
51508
  math.OBB3ToAABB3(tempOBB3b, this._aabbWorld);
51475
51509
  }
51476
- if (this.origin) {
51477
- const origin = this.origin;
51478
- this._aabbWorld[0] += origin[0];
51479
- this._aabbWorld[1] += origin[1];
51480
- this._aabbWorld[2] += origin[2];
51481
- this._aabbWorld[3] += origin[0];
51482
- this._aabbWorld[4] += origin[1];
51483
- this._aabbWorld[5] += origin[2];
51484
- }
51485
51510
  this._aabbWorldDirty = false;
51486
51511
  }
51487
51512
  return this._aabbWorld;
@@ -51717,7 +51742,7 @@ class VBORenderer {
51717
51742
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
51718
51743
  const origin = layer._state.origin;
51719
51744
  if (origin) {
51720
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C);
51745
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$C, model.rotationMatrixConjugate);
51721
51746
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
51722
51747
  } else {
51723
51748
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -71028,7 +71053,7 @@ class DTXLinesColorRenderer {
71028
71053
  if (active) {
71029
71054
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
71030
71055
  if (origin) {
71031
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n);
71056
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, rotationMatrixConjugate);
71032
71057
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
71033
71058
  } else {
71034
71059
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -72941,7 +72966,7 @@ class DTXTrianglesColorRenderer {
72941
72966
  if (active) {
72942
72967
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
72943
72968
  if (origin) {
72944
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m);
72969
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, rotationMatrixConjugate);
72945
72970
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
72946
72971
  } else {
72947
72972
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -73575,7 +73600,7 @@ class DTXTrianglesSilhouetteRenderer {
73575
73600
  if (active) {
73576
73601
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
73577
73602
  if (origin) {
73578
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l);
73603
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, rotationMatrixConjugate);
73579
73604
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
73580
73605
  } else {
73581
73606
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74025,7 +74050,7 @@ class DTXTrianglesEdgesRenderer {
74025
74050
  if (active) {
74026
74051
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74027
74052
  if (origin) {
74028
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74053
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, rotationMatrixConjugate);
74029
74054
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74030
74055
  } else {
74031
74056
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74417,7 +74442,7 @@ class DTXTrianglesEdgesColorRenderer {
74417
74442
  if (active) {
74418
74443
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74419
74444
  if (origin) {
74420
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
74445
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, rotationMatrixConjugate);
74421
74446
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74422
74447
  } else {
74423
74448
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -74838,7 +74863,7 @@ class DTXTrianglesPickMeshRenderer {
74838
74863
  if (active) {
74839
74864
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
74840
74865
  if (origin) {
74841
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
74866
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, rotationMatrixConjugate);
74842
74867
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74843
74868
  } else {
74844
74869
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75285,7 +75310,7 @@ class DTXTrianglesPickDepthRenderer {
75285
75310
  if (active) {
75286
75311
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75287
75312
  if (origin) {
75288
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h);
75313
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, rotationMatrixConjugate);
75289
75314
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75290
75315
  } else {
75291
75316
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -75757,7 +75782,7 @@ class DTXTrianglesSnapRenderer {
75757
75782
  if (active) {
75758
75783
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
75759
75784
  if (origin) {
75760
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
75785
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, rotationMatrixConjugate);
75761
75786
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75762
75787
  } else {
75763
75788
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76182,7 +76207,7 @@ class DTXTrianglesSnapInitRenderer {
76182
76207
  if (active) {
76183
76208
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76184
76209
  if (origin) {
76185
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
76210
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, rotationMatrixConjugate);
76186
76211
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76187
76212
  } else {
76188
76213
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -76631,7 +76656,7 @@ class DTXTrianglesOcclusionRenderer {
76631
76656
  if (active) {
76632
76657
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
76633
76658
  if (origin) {
76634
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
76659
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, rotationMatrixConjugate);
76635
76660
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76636
76661
  } else {
76637
76662
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77034,7 +77059,7 @@ class DTXTrianglesDepthRenderer {
77034
77059
  if (active) {
77035
77060
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77036
77061
  if (origin) {
77037
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
77062
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, rotationMatrixConjugate);
77038
77063
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77039
77064
  } else {
77040
77065
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77485,7 +77510,7 @@ class DTXTrianglesNormalsRenderer {
77485
77510
  if (active) {
77486
77511
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77487
77512
  if (origin) {
77488
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
77513
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, rotationMatrixConjugate);
77489
77514
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77490
77515
  } else {
77491
77516
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -77844,7 +77869,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
77844
77869
  if (active) {
77845
77870
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
77846
77871
  if (origin) {
77847
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
77872
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, rotationMatrixConjugate);
77848
77873
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77849
77874
  } else {
77850
77875
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -85805,6 +85830,7 @@ class SceneModel extends Component {
85805
85830
  cfg.meshMatrix = cfg.transform.worldMatrix;
85806
85831
  }
85807
85832
  mesh.portionId = mesh.layer.createPortion(mesh, cfg);
85833
+ mesh.numPrimitives = cfg.numPrimitives;
85808
85834
  this._meshes[cfg.id] = mesh;
85809
85835
  this._unusedMeshes[cfg.id] = mesh;
85810
85836
  this._meshList.push(mesh);
@@ -86168,7 +86194,7 @@ class SceneModel extends Component {
86168
86194
  flags = flags | ENTITY_FLAGS.SELECTED;
86169
86195
  }
86170
86196
  cfg.flags = flags;
86171
- this._createEntity(cfg);
86197
+ return this._createEntity(cfg);
86172
86198
  }
86173
86199
 
86174
86200
  _createEntity(cfg) {
@@ -86199,6 +86225,7 @@ class SceneModel extends Component {
86199
86225
  this._entities[cfg.id] = entity;
86200
86226
  this._entitiesToFinalize.push(entity);
86201
86227
  this.numEntities++;
86228
+ return entity;
86202
86229
  }
86203
86230
 
86204
86231
  /**
@@ -110445,10 +110472,14 @@ class Viewer {
110445
110472
 
110446
110473
  for (let i = 0, len = pluginContainerElements.length; i < len; i++) {
110447
110474
  const containerElement = pluginContainerElements[i];
110475
+ //only calculate the scale for first plugin
110476
+ //for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
110477
+ //resulting in increase/decreased size for the the canvas that is being overlapped
110478
+ const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
110448
110479
  await html2canvas(containerElement, {
110449
110480
  canvas: snapshotCanvas,
110450
110481
  backgroundColor: null,
110451
- scale: snapshotCanvas.width / containerElement.clientWidth
110482
+ scale
110452
110483
  });
110453
110484
  }
110454
110485
  if (!params.includeGizmos) {
@@ -117959,6 +117990,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
117959
117990
  entityId: options.entityId,
117960
117991
  metaModelJSON,
117961
117992
  autoMetaModel: options.autoMetaModel,
117993
+ globalizeObjectIds: options.globalizeObjectIds,
117962
117994
  metaObjects: [],
117963
117995
  loadBuffer: options.loadBuffer,
117964
117996
  basePath: options.basePath,
@@ -118287,16 +118319,17 @@ function loadDefaultScene(ctx) {
118287
118319
 
118288
118320
  if (entityId) {
118289
118321
  if (meshIds.length > 0) {
118322
+ const globalId = ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, entityId) : entityId;
118290
118323
  ctx.sceneModel.createEntity({
118291
- id: entityId,
118324
+ id: globalId,
118292
118325
  meshIds: meshIds,
118293
118326
  isObject: true
118294
118327
  });
118295
118328
  if (ctx.autoMetaModel) {
118296
118329
  ctx.metaObjects.push({
118297
- id: entityId,
118330
+ id: globalId,
118298
118331
  type: "Default",
118299
- name: entityId,
118332
+ name: globalId,
118300
118333
  parent: ctx.sceneModel.id
118301
118334
  });
118302
118335
  }
@@ -118779,6 +118812,7 @@ class GLTFLoaderPlugin extends Plugin {
118779
118812
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
118780
118813
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
118781
118814
  * @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
118815
+ * @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.
118782
118816
  * @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}
118783
118817
  */
118784
118818
  load(params = {}) {
@@ -126146,6 +126180,9 @@ class RenderService {
126146
126180
  }
126147
126181
  if (indeterminate !== checkbox.indeterminate) {
126148
126182
  checkbox.indeterminate = indeterminate;
126183
+ if (indeterminate) {
126184
+ checkbox.checked = false;
126185
+ }
126149
126186
  }
126150
126187
  }
126151
126188
  }
@@ -133329,9 +133366,9 @@ class XKTLoaderPlugin extends Plugin {
133329
133366
  globalizeObjectIds: options.globalizeObjectIds
133330
133367
  });
133331
133368
  if (params.src) {
133332
- this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);
133369
+ this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
133333
133370
  } else {
133334
- this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);
133371
+ this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
133335
133372
  finish();
133336
133373
  }
133337
133374
  }, (errMsg) => {
@@ -133345,9 +133382,9 @@ class XKTLoaderPlugin extends Plugin {
133345
133382
  globalizeObjectIds: options.globalizeObjectIds
133346
133383
  });
133347
133384
  if (params.src) {
133348
- this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);
133385
+ this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
133349
133386
  } else {
133350
- this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);
133387
+ this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
133351
133388
  finish();
133352
133389
  }
133353
133390
  }
@@ -133356,9 +133393,9 @@ class XKTLoaderPlugin extends Plugin {
133356
133393
  } else {
133357
133394
 
133358
133395
  if (params.src) {
133359
- this._loadModel(params.src, params, options, sceneModel, metaModel, manifestCtx, finish, error);
133396
+ this._loadModel(params.src, options, sceneModel, metaModel, manifestCtx, finish, error);
133360
133397
  } else if (params.xkt) {
133361
- this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
133398
+ this._parseModel(params.xkt, options, sceneModel, metaModel, manifestCtx);
133362
133399
  finish();
133363
133400
  } else if (params.manifestSrc || params.manifest) {
133364
133401
  const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
@@ -133392,7 +133429,7 @@ class XKTLoaderPlugin extends Plugin {
133392
133429
  done();
133393
133430
  } else {
133394
133431
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
133395
- this._parseModel(arrayBuffer, params, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
133432
+ this._parseModel(arrayBuffer, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
133396
133433
  sceneModel.preFinalize();
133397
133434
  i++;
133398
133435
  this.scheduleTask(loadNext, 200);
@@ -133410,7 +133447,7 @@ class XKTLoaderPlugin extends Plugin {
133410
133447
  done();
133411
133448
  } else {
133412
133449
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
133413
- this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
133450
+ this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
133414
133451
  sceneModel.preFinalize();
133415
133452
  i++;
133416
133453
  this.scheduleTask(loadNext, 200);
@@ -133460,15 +133497,15 @@ class XKTLoaderPlugin extends Plugin {
133460
133497
  return sceneModel;
133461
133498
  }
133462
133499
 
133463
- _loadModel(src, params, options, sceneModel, metaModel, manifestCtx, done, error) {
133464
- this._dataSource.getXKT(params.src, (arrayBuffer) => {
133465
- this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
133500
+ _loadModel(src, options, sceneModel, metaModel, manifestCtx, done, error) {
133501
+ this._dataSource.getXKT(src, (arrayBuffer) => {
133502
+ this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
133466
133503
  sceneModel.preFinalize();
133467
133504
  done();
133468
133505
  }, error);
133469
133506
  }
133470
133507
 
133471
- async _parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx) {
133508
+ async _parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx) {
133472
133509
  if (sceneModel.destroyed) {
133473
133510
  return;
133474
133511
  }
@@ -137692,6 +137729,10 @@ class LASLoaderPlugin extends Plugin {
137692
137729
  * @param {Number} [cfg.skip=1] Configures LASLoaderPlugin to load every **n** points.
137693
137730
  * @param {Number} [cfg.fp64=false] Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
137694
137731
  * @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".
137732
+ * @param {Boolean} [cfg.center=false] Whether to center the LAS points. Applied before "rotateX", "rotate" and "transform".
137733
+ * @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
137734
+ * @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".
137735
+ * @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".
137695
137736
  */
137696
137737
  constructor(viewer, cfg = {}) {
137697
137738
 
@@ -137701,6 +137742,10 @@ class LASLoaderPlugin extends Plugin {
137701
137742
  this.skip = cfg.skip;
137702
137743
  this.fp64 = cfg.fp64;
137703
137744
  this.colorDepth = cfg.colorDepth;
137745
+ this.center = cfg.center;
137746
+ this.rotate = cfg.rotate;
137747
+ this.rotateX = cfg.rotateX;
137748
+ this.transform = cfg.transform;
137704
137749
  }
137705
137750
 
137706
137751
  /**
@@ -137795,6 +137840,106 @@ class LASLoaderPlugin extends Plugin {
137795
137840
  this._colorDepth = value || "auto";
137796
137841
  }
137797
137842
 
137843
+ /**
137844
+ * Gets if LASLoaderPlugin immediately centers LAS positions.
137845
+ *
137846
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
137847
+ *
137848
+ * Default value is ````false````.
137849
+ *
137850
+ * @returns {Boolean} True if LASLoaderPlugin immediately centers LAS positions.
137851
+ */
137852
+ get center() {
137853
+ return this._center;
137854
+ }
137855
+
137856
+ /**
137857
+ * Configures if LASLoaderPlugin immediately centers LAS positions.
137858
+ *
137859
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
137860
+ *
137861
+ * Default value is ````false````.
137862
+ *
137863
+ * @param {Boolean} value True if LASLoaderPlugin immediately centers LAS positions.
137864
+ */
137865
+ set center(value) {
137866
+ this._center = !!value;
137867
+ }
137868
+
137869
+ /**
137870
+ * Gets the current transformation to apply to LAS positions as they are loaded.
137871
+ *
137872
+ * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
137873
+ *
137874
+ * Default value is null.
137875
+ *
137876
+ * @returns {Number[]|null} A 16-element array containing a 4x4 transformation matrix.
137877
+ */
137878
+ get transform() {
137879
+ return this._transform;
137880
+ }
137881
+
137882
+ /**
137883
+ * Sets the current transformation to apply to LAS positions as they are loaded.
137884
+ *
137885
+ * If this is ````true````, then LAS positions will be transformed after they are centered and rotated.
137886
+ *
137887
+ * Default value is null.
137888
+ *
137889
+ * @param {Number[]|null} transform A 16-element array containing a 4x4 transformation matrix.
137890
+ */
137891
+ set transform(transform) {
137892
+ this._transform = transform;
137893
+ }
137894
+
137895
+ /**
137896
+ * Gets the current rotations to apply to LAS positions as they are loaded.
137897
+ *
137898
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
137899
+ *
137900
+ * Default value is null.
137901
+ *
137902
+ * @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.
137903
+ */
137904
+ get rotate() {
137905
+ return this._rotate;
137906
+ }
137907
+
137908
+ /**
137909
+ * Sets the current rotations to apply to LAS positions as they are loaded.
137910
+ *
137911
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
137912
+ *
137913
+ * Default value is null.
137914
+ *
137915
+ * @param {Number[]|null} rotate Array of three Euler angles in degrees, for each of the X, Y and Z axis.
137916
+ */
137917
+ set rotate(rotate) {
137918
+ this._rotate = rotate;
137919
+ }
137920
+
137921
+ /**
137922
+ * Gets if LAS positions are rotated 90 degrees about X as they are loaded.
137923
+ *
137924
+ * Default value is ````false````.
137925
+ *
137926
+ * @returns {*}
137927
+ */
137928
+ get rotateX() {
137929
+ return this._rotateX;
137930
+ }
137931
+
137932
+ /**
137933
+ * Sets if LAS positions are rotated 90 degrees about X as they are loaded.
137934
+ *
137935
+ * Default value is ````false````.
137936
+ *
137937
+ * @param rotateX
137938
+ */
137939
+ set rotateX(rotateX) {
137940
+ this._rotateX = rotateX;
137941
+ }
137942
+
137798
137943
  /**
137799
137944
  * Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.
137800
137945
  *
@@ -137874,9 +138019,26 @@ class LASLoaderPlugin extends Plugin {
137874
138019
 
137875
138020
  _parseModel(arrayBuffer, params, options, sceneModel) {
137876
138021
 
137877
- function readPositions(attributesPosition) {
138022
+ const readPositions = (attributesPosition) => {
137878
138023
  const positionsValue = attributesPosition.value;
137879
- if (params.rotateX) {
138024
+ if (this._center) {
138025
+ const centerPos = math.vec3();
138026
+ const numPoints = positionsValue.length;
138027
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138028
+ centerPos[0] += positionsValue[i + 0];
138029
+ centerPos[1] += positionsValue[i + 1];
138030
+ centerPos[2] += positionsValue[i + 2];
138031
+ }
138032
+ centerPos[0] /= numPoints;
138033
+ centerPos[1] /= numPoints;
138034
+ centerPos[2] /= numPoints;
138035
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138036
+ positionsValue[i + 0] -= centerPos[0];
138037
+ positionsValue[i + 1] -= centerPos[1];
138038
+ positionsValue[i + 2] -= centerPos[2];
138039
+ }
138040
+ }
138041
+ if (this._rotateX) {
137880
138042
  if (positionsValue) {
137881
138043
  for (let i = 0, len = positionsValue.length; i < len; i += 3) {
137882
138044
  const temp = positionsValue[i + 1];
@@ -137885,8 +138047,37 @@ class LASLoaderPlugin extends Plugin {
137885
138047
  }
137886
138048
  }
137887
138049
  }
138050
+ if (this._rotate) {
138051
+ const quaternion = math.identityQuaternion();
138052
+ const mat = math.mat4();
138053
+ math.eulerToQuaternion(this._rotate, "XYZ", quaternion);
138054
+ math.quaternionToRotationMat4(quaternion, mat);
138055
+ const pos = math.vec3();
138056
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138057
+ pos[0] = positionsValue[i + 0];
138058
+ pos[1] = positionsValue[i + 1];
138059
+ pos[2] = positionsValue[i + 2];
138060
+ math.transformPoint3(mat, pos, pos);
138061
+ positionsValue[i + 0] = pos[0];
138062
+ positionsValue[i + 1] = pos[1];
138063
+ positionsValue[i + 2] = pos[2];
138064
+ }
138065
+ }
138066
+ if (this._transform) {
138067
+ const mat = math.mat4(this._transform);
138068
+ const pos = math.vec3();
138069
+ for (let i = 0, len = positionsValue.length; i < len; i += 3) {
138070
+ pos[0] = positionsValue[i + 0];
138071
+ pos[1] = positionsValue[i + 1];
138072
+ pos[2] = positionsValue[i + 2];
138073
+ math.transformPoint3(mat, pos, pos);
138074
+ positionsValue[i + 0] = pos[0];
138075
+ positionsValue[i + 1] = pos[1];
138076
+ positionsValue[i + 2] = pos[2];
138077
+ }
138078
+ }
137888
138079
  return positionsValue;
137889
- }
138080
+ };
137890
138081
 
137891
138082
  function readColorsAndIntensities(attributesColor, attributesIntensity) {
137892
138083
  const colors = attributesColor.value;
@@ -140144,7 +140335,8 @@ class DotBIMLoaderPlugin extends Plugin {
140144
140335
  }
140145
140336
  metaModelData.propertySets.push({
140146
140337
  id: objectId,
140147
- properties
140338
+ name: "Properties",
140339
+ properties: properties
140148
140340
  });
140149
140341
 
140150
140342
  metaModelData.metaObjects.push({