@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.
- package/dist/xeokit-sdk.cjs.js +248 -56
- package/dist/xeokit-sdk.es.js +248 -56
- package/dist/xeokit-sdk.es5.js +117 -49
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/extras/ContextMenu/ContextMenu.js +24 -0
- package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +2 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +1 -0
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +5 -3
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +156 -2
- package/src/plugins/TreeViewPlugin/RenderService.js +3 -0
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +12 -12
- package/src/viewer/Viewer.js +5 -1
- package/src/viewer/scene/input/Input.js +5 -9
- package/src/viewer/scene/math/rtcCoords.js +5 -1
- package/src/viewer/scene/model/SceneModel.js +3 -1
- package/src/viewer/scene/model/SceneModelMesh.js +10 -9
- package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +2 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/VBORenderer.js +1 -1
- package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +95 -5
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -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$
|
|
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$
|
|
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,
|
|
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);
|
|
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
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
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.rotationMatrixConjugate);
|
|
51725
51750
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
51726
51751
|
} else {
|
|
51727
51752
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -71032,7 +71057,7 @@ class DTXLinesColorRenderer {
|
|
|
71032
71057
|
if (active) {
|
|
71033
71058
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
71034
71059
|
if (origin) {
|
|
71035
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n);
|
|
71060
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$n, rotationMatrixConjugate);
|
|
71036
71061
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
71037
71062
|
} else {
|
|
71038
71063
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -72945,7 +72970,7 @@ class DTXTrianglesColorRenderer {
|
|
|
72945
72970
|
if (active) {
|
|
72946
72971
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
72947
72972
|
if (origin) {
|
|
72948
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m);
|
|
72973
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$m, rotationMatrixConjugate);
|
|
72949
72974
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
72950
72975
|
} else {
|
|
72951
72976
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -73579,7 +73604,7 @@ class DTXTrianglesSilhouetteRenderer {
|
|
|
73579
73604
|
if (active) {
|
|
73580
73605
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
73581
73606
|
if (origin) {
|
|
73582
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l);
|
|
73607
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$l, rotationMatrixConjugate);
|
|
73583
73608
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
73584
73609
|
} else {
|
|
73585
73610
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -74029,7 +74054,7 @@ class DTXTrianglesEdgesRenderer {
|
|
|
74029
74054
|
if (active) {
|
|
74030
74055
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
74031
74056
|
if (origin) {
|
|
74032
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
|
|
74057
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k, rotationMatrixConjugate);
|
|
74033
74058
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
74034
74059
|
} else {
|
|
74035
74060
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -74421,7 +74446,7 @@ class DTXTrianglesEdgesColorRenderer {
|
|
|
74421
74446
|
if (active) {
|
|
74422
74447
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
74423
74448
|
if (origin) {
|
|
74424
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
|
|
74449
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j, rotationMatrixConjugate);
|
|
74425
74450
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
74426
74451
|
} else {
|
|
74427
74452
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -74842,7 +74867,7 @@ class DTXTrianglesPickMeshRenderer {
|
|
|
74842
74867
|
if (active) {
|
|
74843
74868
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
74844
74869
|
if (origin) {
|
|
74845
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
|
|
74870
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i, rotationMatrixConjugate);
|
|
74846
74871
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
74847
74872
|
} else {
|
|
74848
74873
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -75289,7 +75314,7 @@ class DTXTrianglesPickDepthRenderer {
|
|
|
75289
75314
|
if (active) {
|
|
75290
75315
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
75291
75316
|
if (origin) {
|
|
75292
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h);
|
|
75317
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$h, rotationMatrixConjugate);
|
|
75293
75318
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
75294
75319
|
} else {
|
|
75295
75320
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -75761,7 +75786,7 @@ class DTXTrianglesSnapRenderer {
|
|
|
75761
75786
|
if (active) {
|
|
75762
75787
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
75763
75788
|
if (origin) {
|
|
75764
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
|
|
75789
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g, rotationMatrixConjugate);
|
|
75765
75790
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
75766
75791
|
} else {
|
|
75767
75792
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -76186,7 +76211,7 @@ class DTXTrianglesSnapInitRenderer {
|
|
|
76186
76211
|
if (active) {
|
|
76187
76212
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
76188
76213
|
if (origin) {
|
|
76189
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
|
|
76214
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f, rotationMatrixConjugate);
|
|
76190
76215
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
76191
76216
|
} else {
|
|
76192
76217
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -76635,7 +76660,7 @@ class DTXTrianglesOcclusionRenderer {
|
|
|
76635
76660
|
if (active) {
|
|
76636
76661
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
76637
76662
|
if (origin) {
|
|
76638
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
|
|
76663
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e, rotationMatrixConjugate);
|
|
76639
76664
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
76640
76665
|
} else {
|
|
76641
76666
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -77038,7 +77063,7 @@ class DTXTrianglesDepthRenderer {
|
|
|
77038
77063
|
if (active) {
|
|
77039
77064
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
77040
77065
|
if (origin) {
|
|
77041
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
|
|
77066
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d, rotationMatrixConjugate);
|
|
77042
77067
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
77043
77068
|
} else {
|
|
77044
77069
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -77489,7 +77514,7 @@ class DTXTrianglesNormalsRenderer {
|
|
|
77489
77514
|
if (active) {
|
|
77490
77515
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
77491
77516
|
if (origin) {
|
|
77492
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
|
|
77517
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c, rotationMatrixConjugate);
|
|
77493
77518
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
77494
77519
|
} else {
|
|
77495
77520
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -77848,7 +77873,7 @@ class DTXTrianglesPickNormalsFlatRenderer {
|
|
|
77848
77873
|
if (active) {
|
|
77849
77874
|
const sectionPlane = sectionPlanes[sectionPlaneIndex];
|
|
77850
77875
|
if (origin) {
|
|
77851
|
-
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
|
|
77876
|
+
const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b, rotationMatrixConjugate);
|
|
77852
77877
|
gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
|
|
77853
77878
|
} else {
|
|
77854
77879
|
gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
|
|
@@ -85809,6 +85834,7 @@ class SceneModel extends Component {
|
|
|
85809
85834
|
cfg.meshMatrix = cfg.transform.worldMatrix;
|
|
85810
85835
|
}
|
|
85811
85836
|
mesh.portionId = mesh.layer.createPortion(mesh, cfg);
|
|
85837
|
+
mesh.numPrimitives = cfg.numPrimitives;
|
|
85812
85838
|
this._meshes[cfg.id] = mesh;
|
|
85813
85839
|
this._unusedMeshes[cfg.id] = mesh;
|
|
85814
85840
|
this._meshList.push(mesh);
|
|
@@ -86172,7 +86198,7 @@ class SceneModel extends Component {
|
|
|
86172
86198
|
flags = flags | ENTITY_FLAGS.SELECTED;
|
|
86173
86199
|
}
|
|
86174
86200
|
cfg.flags = flags;
|
|
86175
|
-
this._createEntity(cfg);
|
|
86201
|
+
return this._createEntity(cfg);
|
|
86176
86202
|
}
|
|
86177
86203
|
|
|
86178
86204
|
_createEntity(cfg) {
|
|
@@ -86203,6 +86229,7 @@ class SceneModel extends Component {
|
|
|
86203
86229
|
this._entities[cfg.id] = entity;
|
|
86204
86230
|
this._entitiesToFinalize.push(entity);
|
|
86205
86231
|
this.numEntities++;
|
|
86232
|
+
return entity;
|
|
86206
86233
|
}
|
|
86207
86234
|
|
|
86208
86235
|
/**
|
|
@@ -110449,10 +110476,14 @@ class Viewer {
|
|
|
110449
110476
|
|
|
110450
110477
|
for (let i = 0, len = pluginContainerElements.length; i < len; i++) {
|
|
110451
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;
|
|
110452
110483
|
await html2canvas(containerElement, {
|
|
110453
110484
|
canvas: snapshotCanvas,
|
|
110454
110485
|
backgroundColor: null,
|
|
110455
|
-
scale
|
|
110486
|
+
scale
|
|
110456
110487
|
});
|
|
110457
110488
|
}
|
|
110458
110489
|
if (!params.includeGizmos) {
|
|
@@ -117963,6 +117994,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
|
|
|
117963
117994
|
entityId: options.entityId,
|
|
117964
117995
|
metaModelJSON,
|
|
117965
117996
|
autoMetaModel: options.autoMetaModel,
|
|
117997
|
+
globalizeObjectIds: options.globalizeObjectIds,
|
|
117966
117998
|
metaObjects: [],
|
|
117967
117999
|
loadBuffer: options.loadBuffer,
|
|
117968
118000
|
basePath: options.basePath,
|
|
@@ -118291,16 +118323,17 @@ function loadDefaultScene(ctx) {
|
|
|
118291
118323
|
|
|
118292
118324
|
if (entityId) {
|
|
118293
118325
|
if (meshIds.length > 0) {
|
|
118326
|
+
const globalId = ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, entityId) : entityId;
|
|
118294
118327
|
ctx.sceneModel.createEntity({
|
|
118295
|
-
id:
|
|
118328
|
+
id: globalId,
|
|
118296
118329
|
meshIds: meshIds,
|
|
118297
118330
|
isObject: true
|
|
118298
118331
|
});
|
|
118299
118332
|
if (ctx.autoMetaModel) {
|
|
118300
118333
|
ctx.metaObjects.push({
|
|
118301
|
-
id:
|
|
118334
|
+
id: globalId,
|
|
118302
118335
|
type: "Default",
|
|
118303
|
-
name:
|
|
118336
|
+
name: globalId,
|
|
118304
118337
|
parent: ctx.sceneModel.id
|
|
118305
118338
|
});
|
|
118306
118339
|
}
|
|
@@ -118783,6 +118816,7 @@ class GLTFLoaderPlugin extends Plugin {
|
|
|
118783
118816
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
118784
118817
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
118785
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.
|
|
118786
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}
|
|
118787
118821
|
*/
|
|
118788
118822
|
load(params = {}) {
|
|
@@ -126150,6 +126184,9 @@ class RenderService {
|
|
|
126150
126184
|
}
|
|
126151
126185
|
if (indeterminate !== checkbox.indeterminate) {
|
|
126152
126186
|
checkbox.indeterminate = indeterminate;
|
|
126187
|
+
if (indeterminate) {
|
|
126188
|
+
checkbox.checked = false;
|
|
126189
|
+
}
|
|
126153
126190
|
}
|
|
126154
126191
|
}
|
|
126155
126192
|
}
|
|
@@ -133333,9 +133370,9 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
133333
133370
|
globalizeObjectIds: options.globalizeObjectIds
|
|
133334
133371
|
});
|
|
133335
133372
|
if (params.src) {
|
|
133336
|
-
this._loadModel(params.src,
|
|
133373
|
+
this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
|
|
133337
133374
|
} else {
|
|
133338
|
-
this._parseModel(params.xkt,
|
|
133375
|
+
this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
|
|
133339
133376
|
finish();
|
|
133340
133377
|
}
|
|
133341
133378
|
}, (errMsg) => {
|
|
@@ -133349,9 +133386,9 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
133349
133386
|
globalizeObjectIds: options.globalizeObjectIds
|
|
133350
133387
|
});
|
|
133351
133388
|
if (params.src) {
|
|
133352
|
-
this._loadModel(params.src,
|
|
133389
|
+
this._loadModel(params.src, options, sceneModel, null, manifestCtx, finish, error);
|
|
133353
133390
|
} else {
|
|
133354
|
-
this._parseModel(params.xkt,
|
|
133391
|
+
this._parseModel(params.xkt, options, sceneModel, null, manifestCtx);
|
|
133355
133392
|
finish();
|
|
133356
133393
|
}
|
|
133357
133394
|
}
|
|
@@ -133360,9 +133397,9 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
133360
133397
|
} else {
|
|
133361
133398
|
|
|
133362
133399
|
if (params.src) {
|
|
133363
|
-
this._loadModel(params.src,
|
|
133400
|
+
this._loadModel(params.src, options, sceneModel, metaModel, manifestCtx, finish, error);
|
|
133364
133401
|
} else if (params.xkt) {
|
|
133365
|
-
this._parseModel(params.xkt,
|
|
133402
|
+
this._parseModel(params.xkt, options, sceneModel, metaModel, manifestCtx);
|
|
133366
133403
|
finish();
|
|
133367
133404
|
} else if (params.manifestSrc || params.manifest) {
|
|
133368
133405
|
const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
@@ -133396,7 +133433,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
133396
133433
|
done();
|
|
133397
133434
|
} else {
|
|
133398
133435
|
this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
|
|
133399
|
-
this._parseModel(arrayBuffer,
|
|
133436
|
+
this._parseModel(arrayBuffer, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);
|
|
133400
133437
|
sceneModel.preFinalize();
|
|
133401
133438
|
i++;
|
|
133402
133439
|
this.scheduleTask(loadNext, 200);
|
|
@@ -133414,7 +133451,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
133414
133451
|
done();
|
|
133415
133452
|
} else {
|
|
133416
133453
|
this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
|
|
133417
|
-
this._parseModel(arrayBuffer,
|
|
133454
|
+
this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
|
|
133418
133455
|
sceneModel.preFinalize();
|
|
133419
133456
|
i++;
|
|
133420
133457
|
this.scheduleTask(loadNext, 200);
|
|
@@ -133464,15 +133501,15 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
133464
133501
|
return sceneModel;
|
|
133465
133502
|
}
|
|
133466
133503
|
|
|
133467
|
-
_loadModel(src,
|
|
133468
|
-
this._dataSource.getXKT(
|
|
133469
|
-
this._parseModel(arrayBuffer,
|
|
133504
|
+
_loadModel(src, options, sceneModel, metaModel, manifestCtx, done, error) {
|
|
133505
|
+
this._dataSource.getXKT(src, (arrayBuffer) => {
|
|
133506
|
+
this._parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx);
|
|
133470
133507
|
sceneModel.preFinalize();
|
|
133471
133508
|
done();
|
|
133472
133509
|
}, error);
|
|
133473
133510
|
}
|
|
133474
133511
|
|
|
133475
|
-
async _parseModel(arrayBuffer,
|
|
133512
|
+
async _parseModel(arrayBuffer, options, sceneModel, metaModel, manifestCtx) {
|
|
133476
133513
|
if (sceneModel.destroyed) {
|
|
133477
133514
|
return;
|
|
133478
133515
|
}
|
|
@@ -137696,6 +137733,10 @@ class LASLoaderPlugin extends Plugin {
|
|
|
137696
137733
|
* @param {Number} [cfg.skip=1] Configures LASLoaderPlugin to load every **n** points.
|
|
137697
137734
|
* @param {Number} [cfg.fp64=false] Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
|
|
137698
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".
|
|
137699
137740
|
*/
|
|
137700
137741
|
constructor(viewer, cfg = {}) {
|
|
137701
137742
|
|
|
@@ -137705,6 +137746,10 @@ class LASLoaderPlugin extends Plugin {
|
|
|
137705
137746
|
this.skip = cfg.skip;
|
|
137706
137747
|
this.fp64 = cfg.fp64;
|
|
137707
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;
|
|
137708
137753
|
}
|
|
137709
137754
|
|
|
137710
137755
|
/**
|
|
@@ -137799,6 +137844,106 @@ class LASLoaderPlugin extends Plugin {
|
|
|
137799
137844
|
this._colorDepth = value || "auto";
|
|
137800
137845
|
}
|
|
137801
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
|
+
|
|
137802
137947
|
/**
|
|
137803
137948
|
* Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.
|
|
137804
137949
|
*
|
|
@@ -137878,9 +138023,26 @@ class LASLoaderPlugin extends Plugin {
|
|
|
137878
138023
|
|
|
137879
138024
|
_parseModel(arrayBuffer, params, options, sceneModel) {
|
|
137880
138025
|
|
|
137881
|
-
|
|
138026
|
+
const readPositions = (attributesPosition) => {
|
|
137882
138027
|
const positionsValue = attributesPosition.value;
|
|
137883
|
-
if (
|
|
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
|
-
|
|
140342
|
+
name: "Properties",
|
|
140343
|
+
properties: properties
|
|
140152
140344
|
});
|
|
140153
140345
|
|
|
140154
140346
|
metaModelData.metaObjects.push({
|