@xeokit/xeokit-sdk 2.6.30 → 2.6.32
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/README.md +17 -23
- package/dist/xeokit-sdk.cjs.js +353 -336
- package/dist/xeokit-sdk.es.js +353 -336
- package/dist/xeokit-sdk.es5.js +412 -408
- package/dist/xeokit-sdk.min.cjs.js +4 -4
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +110 -33
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +7 -2
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +1 -1
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +5 -1
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +97 -148
- package/src/plugins/lib/html/Dot.js +2 -2
- package/src/viewer/scene/webgl/Renderer.js +132 -154
- package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +5 -3
- package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +2 -2
- package/types/plugins/OBJLoaderPlugin/OBJLoaderPlugin.d.ts +3 -3
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -9554,7 +9554,7 @@ class Dot {
|
|
|
9554
9554
|
this._dotClickable = document.createElement('div');
|
|
9555
9555
|
this._dotClickable.className += this._dotClickable.className ? ' viewer-ruler-dot-clickable' : 'viewer-ruler-dot-clickable';
|
|
9556
9556
|
|
|
9557
|
-
this._visible =
|
|
9557
|
+
this._visible = cfg.visible !== false;
|
|
9558
9558
|
this._culled = false;
|
|
9559
9559
|
|
|
9560
9560
|
var dot = this._dot;
|
|
@@ -9566,7 +9566,7 @@ class Dot {
|
|
|
9566
9566
|
dotStyle["z-index"] = cfg.zIndex === undefined ? "40000005" : cfg.zIndex ;
|
|
9567
9567
|
dotStyle.width = 8 + "px";
|
|
9568
9568
|
dotStyle.height = 8 + "px";
|
|
9569
|
-
dotStyle.visibility =
|
|
9569
|
+
dotStyle.visibility = this._visible ? "visible" : "hidden";
|
|
9570
9570
|
dotStyle.top = 0 + "px";
|
|
9571
9571
|
dotStyle.left = 0 + "px";
|
|
9572
9572
|
dotStyle["box-shadow"] = "0 2px 5px 0 #182A3D;";
|
|
@@ -19148,6 +19148,9 @@ const Renderer$1 = function (scene, options) {
|
|
|
19148
19148
|
let drawableTypeInfo = {};
|
|
19149
19149
|
let drawables = {};
|
|
19150
19150
|
|
|
19151
|
+
let postSortDrawableList = [];
|
|
19152
|
+
let postCullDrawableList = [];
|
|
19153
|
+
|
|
19151
19154
|
let drawableListDirty = true;
|
|
19152
19155
|
let stateSortDirty = true;
|
|
19153
19156
|
let imageDirty = true;
|
|
@@ -19368,33 +19371,33 @@ const Renderer$1 = function (scene, options) {
|
|
|
19368
19371
|
}
|
|
19369
19372
|
|
|
19370
19373
|
function sortDrawableList() {
|
|
19374
|
+
let lenDrawableList = 0;
|
|
19371
19375
|
for (let type in drawableTypeInfo) {
|
|
19372
19376
|
if (drawableTypeInfo.hasOwnProperty(type)) {
|
|
19373
19377
|
const drawableInfo = drawableTypeInfo[type];
|
|
19374
|
-
|
|
19375
|
-
|
|
19378
|
+
const drawableListPreCull = drawableInfo.drawableListPreCull;
|
|
19379
|
+
for (let i = 0, len = drawableListPreCull.length; i < len; i++) {
|
|
19380
|
+
const drawable = drawableListPreCull[i];
|
|
19381
|
+
postSortDrawableList[lenDrawableList++] = drawable;
|
|
19376
19382
|
}
|
|
19377
19383
|
}
|
|
19378
19384
|
}
|
|
19385
|
+
postSortDrawableList.length = lenDrawableList;
|
|
19386
|
+
postSortDrawableList.sort((a, b) => {
|
|
19387
|
+
return a.renderOrder - b.renderOrder;
|
|
19388
|
+
});
|
|
19379
19389
|
}
|
|
19380
19390
|
|
|
19381
19391
|
function cullDrawableList() {
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
for (let i = 0, len = drawableListPreCull.length; i < len; i++) {
|
|
19389
|
-
const drawable = drawableListPreCull[i];
|
|
19390
|
-
drawable.rebuildRenderFlags();
|
|
19391
|
-
if (!drawable.renderFlags.culled) {
|
|
19392
|
-
drawableList[lenDrawableList++] = drawable;
|
|
19393
|
-
}
|
|
19394
|
-
}
|
|
19395
|
-
drawableList.length = lenDrawableList;
|
|
19392
|
+
let lenDrawableList = 0;
|
|
19393
|
+
for (let i = 0, len = postSortDrawableList.length; i < len; i++) {
|
|
19394
|
+
const drawable = postSortDrawableList[i];
|
|
19395
|
+
drawable.rebuildRenderFlags();
|
|
19396
|
+
if (!drawable.renderFlags.culled) {
|
|
19397
|
+
postCullDrawableList[lenDrawableList++] = drawable;
|
|
19396
19398
|
}
|
|
19397
19399
|
}
|
|
19400
|
+
postCullDrawableList.length = lenDrawableList;
|
|
19398
19401
|
}
|
|
19399
19402
|
|
|
19400
19403
|
function draw(params) {
|
|
@@ -19470,25 +19473,16 @@ const Renderer$1 = function (scene, options) {
|
|
|
19470
19473
|
if (params.clear !== false) {
|
|
19471
19474
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
19472
19475
|
}
|
|
19476
|
+
for (let i = 0, len = postCullDrawableList.length; i < len; i++) {
|
|
19473
19477
|
|
|
19474
|
-
|
|
19475
|
-
if (drawableTypeInfo.hasOwnProperty(type)) {
|
|
19476
|
-
|
|
19477
|
-
const drawableInfo = drawableTypeInfo[type];
|
|
19478
|
-
const drawableList = drawableInfo.drawableList;
|
|
19479
|
-
|
|
19480
|
-
for (let i = 0, len = drawableList.length; i < len; i++) {
|
|
19481
|
-
|
|
19482
|
-
const drawable = drawableList[i];
|
|
19478
|
+
const drawable = postCullDrawableList[i];
|
|
19483
19479
|
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19480
|
+
if (drawable.culled === true || drawable.visible === false || !drawable.drawDepth || !drawable.saoEnabled) {
|
|
19481
|
+
continue;
|
|
19482
|
+
}
|
|
19487
19483
|
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
}
|
|
19491
|
-
}
|
|
19484
|
+
if (drawable.renderFlags.colorOpaque) {
|
|
19485
|
+
drawable.drawDepth(frameCtx);
|
|
19492
19486
|
}
|
|
19493
19487
|
}
|
|
19494
19488
|
|
|
@@ -19627,7 +19621,6 @@ const Renderer$1 = function (scene, options) {
|
|
|
19627
19621
|
}
|
|
19628
19622
|
|
|
19629
19623
|
let i;
|
|
19630
|
-
let len;
|
|
19631
19624
|
let drawable;
|
|
19632
19625
|
|
|
19633
19626
|
const startTime = Date.now();
|
|
@@ -19660,93 +19653,85 @@ const Renderer$1 = function (scene, options) {
|
|
|
19660
19653
|
// Render normal opaque solids, defer others to bins to render after
|
|
19661
19654
|
//------------------------------------------------------------------------------------------------------
|
|
19662
19655
|
|
|
19663
|
-
for (let
|
|
19664
|
-
if (drawableTypeInfo.hasOwnProperty(type)) {
|
|
19665
|
-
|
|
19666
|
-
const drawableInfo = drawableTypeInfo[type];
|
|
19667
|
-
const drawableList = drawableInfo.drawableList;
|
|
19668
|
-
|
|
19669
|
-
for (i = 0, len = drawableList.length; i < len; i++) {
|
|
19656
|
+
for (let i = 0, len = postCullDrawableList.length; i < len; i++) {
|
|
19670
19657
|
|
|
19671
|
-
|
|
19658
|
+
drawable = postCullDrawableList[i];
|
|
19672
19659
|
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19660
|
+
if (drawable.culled === true || drawable.visible === false) {
|
|
19661
|
+
continue;
|
|
19662
|
+
}
|
|
19676
19663
|
|
|
19677
|
-
|
|
19664
|
+
const renderFlags = drawable.renderFlags;
|
|
19678
19665
|
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19666
|
+
if (renderFlags.colorOpaque) {
|
|
19667
|
+
if (saoEnabled && saoPossible && drawable.saoEnabled) {
|
|
19668
|
+
normalDrawSAOBin[normalDrawSAOBinLen++] = drawable;
|
|
19669
|
+
} else {
|
|
19670
|
+
drawable.drawColorOpaque(frameCtx);
|
|
19671
|
+
}
|
|
19672
|
+
}
|
|
19686
19673
|
|
|
19687
|
-
|
|
19688
|
-
|
|
19689
|
-
|
|
19690
|
-
|
|
19691
|
-
|
|
19674
|
+
if (transparentEnabled) {
|
|
19675
|
+
if (renderFlags.colorTransparent) {
|
|
19676
|
+
normalFillTransparentBin[normalFillTransparentBinLen++] = drawable;
|
|
19677
|
+
}
|
|
19678
|
+
}
|
|
19692
19679
|
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
19680
|
+
if (renderFlags.xrayedSilhouetteTransparent) {
|
|
19681
|
+
xrayedFillTransparentBin[xrayedFillTransparentBinLen++] = drawable;
|
|
19682
|
+
}
|
|
19696
19683
|
|
|
19697
|
-
|
|
19698
|
-
|
|
19699
|
-
|
|
19684
|
+
if (renderFlags.xrayedSilhouetteOpaque) {
|
|
19685
|
+
xrayedFillOpaqueBin[xrayedFillOpaqueBinLen++] = drawable;
|
|
19686
|
+
}
|
|
19700
19687
|
|
|
19701
|
-
|
|
19702
|
-
|
|
19703
|
-
|
|
19688
|
+
if (renderFlags.highlightedSilhouetteTransparent) {
|
|
19689
|
+
highlightedFillTransparentBin[highlightedFillTransparentBinLen++] = drawable;
|
|
19690
|
+
}
|
|
19704
19691
|
|
|
19705
|
-
|
|
19706
|
-
|
|
19707
|
-
|
|
19692
|
+
if (renderFlags.highlightedSilhouetteOpaque) {
|
|
19693
|
+
highlightedFillOpaqueBin[highlightedFillOpaqueBinLen++] = drawable;
|
|
19694
|
+
}
|
|
19708
19695
|
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
|
|
19696
|
+
if (renderFlags.selectedSilhouetteTransparent) {
|
|
19697
|
+
selectedFillTransparentBin[selectedFillTransparentBinLen++] = drawable;
|
|
19698
|
+
}
|
|
19712
19699
|
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19700
|
+
if (renderFlags.selectedSilhouetteOpaque) {
|
|
19701
|
+
selectedFillOpaqueBin[selectedFillOpaqueBinLen++] = drawable;
|
|
19702
|
+
}
|
|
19716
19703
|
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19704
|
+
if (drawable.edges && edgesEnabled) {
|
|
19705
|
+
if (renderFlags.edgesOpaque) {
|
|
19706
|
+
normalEdgesOpaqueBin[normalEdgesOpaqueBinLen++] = drawable;
|
|
19707
|
+
}
|
|
19721
19708
|
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19709
|
+
if (renderFlags.edgesTransparent) {
|
|
19710
|
+
normalEdgesTransparentBin[normalEdgesTransparentBinLen++] = drawable;
|
|
19711
|
+
}
|
|
19725
19712
|
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19713
|
+
if (renderFlags.selectedEdgesTransparent) {
|
|
19714
|
+
selectedEdgesTransparentBin[selectedEdgesTransparentBinLen++] = drawable;
|
|
19715
|
+
}
|
|
19729
19716
|
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19717
|
+
if (renderFlags.selectedEdgesOpaque) {
|
|
19718
|
+
selectedEdgesOpaqueBin[selectedEdgesOpaqueBinLen++] = drawable;
|
|
19719
|
+
}
|
|
19733
19720
|
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19721
|
+
if (renderFlags.xrayedEdgesTransparent) {
|
|
19722
|
+
xrayEdgesTransparentBin[xrayEdgesTransparentBinLen++] = drawable;
|
|
19723
|
+
}
|
|
19737
19724
|
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19725
|
+
if (renderFlags.xrayedEdgesOpaque) {
|
|
19726
|
+
xrayEdgesOpaqueBin[xrayEdgesOpaqueBinLen++] = drawable;
|
|
19727
|
+
}
|
|
19741
19728
|
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19729
|
+
if (renderFlags.highlightedEdgesTransparent) {
|
|
19730
|
+
highlightedEdgesTransparentBin[highlightedEdgesTransparentBinLen++] = drawable;
|
|
19731
|
+
}
|
|
19745
19732
|
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
}
|
|
19749
|
-
}
|
|
19733
|
+
if (renderFlags.highlightedEdgesOpaque) {
|
|
19734
|
+
highlightedEdgesOpaqueBin[highlightedEdgesOpaqueBinLen++] = drawable;
|
|
19750
19735
|
}
|
|
19751
19736
|
}
|
|
19752
19737
|
}
|
|
@@ -20152,7 +20137,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
20152
20137
|
frameCtx.pickInvisible = !!params.pickInvisible;
|
|
20153
20138
|
frameCtx.pickClipPos = [
|
|
20154
20139
|
getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),
|
|
20155
|
-
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight)
|
|
20140
|
+
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight)
|
|
20156
20141
|
];
|
|
20157
20142
|
|
|
20158
20143
|
gl.viewport(0, 0, 1, 1);
|
|
@@ -20165,30 +20150,23 @@ const Renderer$1 = function (scene, options) {
|
|
|
20165
20150
|
const includeEntityIds = params.includeEntityIds;
|
|
20166
20151
|
const excludeEntityIds = params.excludeEntityIds;
|
|
20167
20152
|
|
|
20168
|
-
for (let
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20180
|
-
|
|
20181
|
-
if (includeEntityIds && !includeEntityIds[drawable.id]) { // TODO: push this logic into drawable
|
|
20182
|
-
continue;
|
|
20183
|
-
}
|
|
20184
|
-
if (excludeEntityIds && excludeEntityIds[drawable.id]) {
|
|
20185
|
-
continue;
|
|
20186
|
-
}
|
|
20187
|
-
|
|
20188
|
-
drawable.drawPickMesh(frameCtx);
|
|
20189
|
-
}
|
|
20153
|
+
for (let i = 0, len = postCullDrawableList.length; i < len; i++) {
|
|
20154
|
+
const drawable = postCullDrawableList[i];
|
|
20155
|
+
if (drawable.culled === true || drawable.visible === false) {
|
|
20156
|
+
continue;
|
|
20157
|
+
}
|
|
20158
|
+
if (!drawable.drawPickMesh || (params.pickInvisible !== true && drawable.visible === false) || drawable.pickable === false) {
|
|
20159
|
+
continue;
|
|
20160
|
+
}
|
|
20161
|
+
if (includeEntityIds && !includeEntityIds[drawable.id]) { // TODO: push this logic into drawable
|
|
20162
|
+
continue;
|
|
20163
|
+
}
|
|
20164
|
+
if (excludeEntityIds && excludeEntityIds[drawable.id]) {
|
|
20165
|
+
continue;
|
|
20190
20166
|
}
|
|
20167
|
+
drawable.drawPickMesh(frameCtx);
|
|
20191
20168
|
}
|
|
20169
|
+
|
|
20192
20170
|
const pix = pickBuffer.read(0, 0);
|
|
20193
20171
|
const pickID = pix[0] + (pix[1] << 8) + (pix[2] << 16) + (pix[3] << 24);
|
|
20194
20172
|
|
|
@@ -20218,7 +20196,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
20218
20196
|
// frameCtx.pickInvisible = !!params.pickInvisible;
|
|
20219
20197
|
frameCtx.pickClipPos = [
|
|
20220
20198
|
getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),
|
|
20221
|
-
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight)
|
|
20199
|
+
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight)
|
|
20222
20200
|
];
|
|
20223
20201
|
|
|
20224
20202
|
gl.viewport(0, 0, 1, 1);
|
|
@@ -20267,7 +20245,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
20267
20245
|
frameCtx.pickElementsOffset = pickable.pickElementsOffset;
|
|
20268
20246
|
frameCtx.pickClipPos = [
|
|
20269
20247
|
getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),
|
|
20270
|
-
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight)
|
|
20248
|
+
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight)
|
|
20271
20249
|
];
|
|
20272
20250
|
|
|
20273
20251
|
gl.viewport(0, 0, 1, 1);
|
|
@@ -20332,15 +20310,14 @@ const Renderer$1 = function (scene, options) {
|
|
|
20332
20310
|
function drawSnapInit(frameCtx) {
|
|
20333
20311
|
frameCtx.snapPickLayerParams = [];
|
|
20334
20312
|
frameCtx.snapPickLayerNumber = 0;
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
}
|
|
20313
|
+
|
|
20314
|
+
for (let i = 0, len = postCullDrawableList.length; i < len; i++) {
|
|
20315
|
+
|
|
20316
|
+
const drawable = postCullDrawableList[i];
|
|
20317
|
+
|
|
20318
|
+
if (drawable.drawSnapInit) {
|
|
20319
|
+
if (!drawable.culled && drawable.visible && drawable.pickable) {
|
|
20320
|
+
drawable.drawSnapInit(frameCtx);
|
|
20344
20321
|
}
|
|
20345
20322
|
}
|
|
20346
20323
|
}
|
|
@@ -20350,11 +20327,11 @@ const Renderer$1 = function (scene, options) {
|
|
|
20350
20327
|
function drawSnap(frameCtx) {
|
|
20351
20328
|
frameCtx.snapPickLayerParams = frameCtx.snapPickLayerParams || [];
|
|
20352
20329
|
frameCtx.snapPickLayerNumber = frameCtx.snapPickLayerParams.length;
|
|
20353
|
-
for (let
|
|
20354
|
-
|
|
20355
|
-
const
|
|
20356
|
-
|
|
20357
|
-
|
|
20330
|
+
for (let i = 0, len = postCullDrawableList.length; i < len; i++) {
|
|
20331
|
+
|
|
20332
|
+
const drawable = postCullDrawableList[i];
|
|
20333
|
+
|
|
20334
|
+
if (drawable.drawSnapInit) {
|
|
20358
20335
|
if (drawable.drawSnap) {
|
|
20359
20336
|
if (!drawable.culled && drawable.visible && drawable.pickable) {
|
|
20360
20337
|
drawable.drawSnap(frameCtx);
|
|
@@ -20500,6 +20477,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
20500
20477
|
// result 1) regular hi-precision world position
|
|
20501
20478
|
|
|
20502
20479
|
let worldPos = null;
|
|
20480
|
+
let worldNormal = null;
|
|
20481
|
+
let pickable = null;
|
|
20503
20482
|
|
|
20504
20483
|
const middleX = snapRadiusInPixels;
|
|
20505
20484
|
const middleY = snapRadiusInPixels;
|
|
@@ -20517,7 +20496,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
20517
20496
|
pickResultMiddleXY[1] * scale[1] + origin[1],
|
|
20518
20497
|
pickResultMiddleXY[2] * scale[2] + origin[2],
|
|
20519
20498
|
];
|
|
20520
|
-
math.normalizeVec3([
|
|
20499
|
+
worldNormal = math.normalizeVec3([
|
|
20521
20500
|
pickNormalResultMiddleXY[0] / math.MAX_INT,
|
|
20522
20501
|
pickNormalResultMiddleXY[1] / math.MAX_INT,
|
|
20523
20502
|
pickNormalResultMiddleXY[2] / math.MAX_INT,
|
|
@@ -20529,7 +20508,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
20529
20508
|
+ (pickPickableResultMiddleXY[2] << 16)
|
|
20530
20509
|
+ (pickPickableResultMiddleXY[3] << 24);
|
|
20531
20510
|
|
|
20532
|
-
pickIDs.items[pickID];
|
|
20511
|
+
pickable = pickIDs.items[pickID];
|
|
20533
20512
|
}
|
|
20534
20513
|
|
|
20535
20514
|
// result 2) hi-precision snapped (to vertex/edge) world position
|
|
@@ -20626,13 +20605,16 @@ const Renderer$1 = function (scene, options) {
|
|
|
20626
20605
|
}
|
|
20627
20606
|
|
|
20628
20607
|
const snappedEntity = (snappedPickable && snappedPickable.delegatePickedEntity) ? snappedPickable.delegatePickedEntity() : snappedPickable;
|
|
20608
|
+
if (!snappedEntity && pickable) {
|
|
20609
|
+
pickable = pickable.delegatePickedEntity ? pickable.delegatePickedEntity() : pickable;
|
|
20610
|
+
}
|
|
20629
20611
|
|
|
20630
20612
|
pickResult.reset();
|
|
20631
20613
|
pickResult.snappedToEdge = (snapType === "edge");
|
|
20632
20614
|
pickResult.snappedToVertex = (snapType === "vertex");
|
|
20633
|
-
pickResult.worldPos = snappedWorldPos;
|
|
20634
|
-
pickResult.worldNormal = snappedWorldNormal;
|
|
20635
|
-
pickResult.entity = snappedEntity;
|
|
20615
|
+
pickResult.worldPos = snappedWorldPos || worldPos;
|
|
20616
|
+
pickResult.worldNormal = snappedWorldNormal || worldNormal;
|
|
20617
|
+
pickResult.entity = snappedEntity || pickable;
|
|
20636
20618
|
pickResult.canvasPos = canvasPos || scene.camera.projectWorldPos(worldPos || snappedWorldPos);
|
|
20637
20619
|
pickResult.snappedCanvasPos = snappedCanvasPos || canvasPos;
|
|
20638
20620
|
|
|
@@ -20739,19 +20721,16 @@ const Renderer$1 = function (scene, options) {
|
|
|
20739
20721
|
gl.disable(gl.BLEND);
|
|
20740
20722
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
20741
20723
|
|
|
20742
|
-
for (let type in drawableTypeInfo) {
|
|
20743
|
-
if (drawableTypeInfo.hasOwnProperty(type)) {
|
|
20744
|
-
const drawableInfo = drawableTypeInfo[type];
|
|
20745
|
-
const drawableList = drawableInfo.drawableList;
|
|
20746
|
-
for (let i = 0, len = drawableList.length; i < len; i++) {
|
|
20747
|
-
const drawable = drawableList[i];
|
|
20748
|
-
if (!drawable.drawOcclusion || drawable.culled === true || drawable.visible === false || drawable.pickable === false) { // TODO: Option to exclude transparent?
|
|
20749
|
-
continue;
|
|
20750
|
-
}
|
|
20751
20724
|
|
|
20752
|
-
|
|
20753
|
-
|
|
20725
|
+
for (let i = 0, len = postCullDrawableList.length; i < len; i++) {
|
|
20726
|
+
|
|
20727
|
+
const drawable = postCullDrawableList[i];
|
|
20728
|
+
|
|
20729
|
+
if (!drawable.drawOcclusion || drawable.culled === true || drawable.visible === false || drawable.pickable === false) { // TODO: Option to exclude transparent?
|
|
20730
|
+
continue;
|
|
20754
20731
|
}
|
|
20732
|
+
|
|
20733
|
+
drawable.drawOcclusion(frameCtx);
|
|
20755
20734
|
}
|
|
20756
20735
|
|
|
20757
20736
|
this._occlusionTester.drawMarkers(frameCtx);
|
|
@@ -118166,7 +118145,7 @@ const parseNodesWithNames = (function () {
|
|
|
118166
118145
|
|
|
118167
118146
|
const objectIdStack = [];
|
|
118168
118147
|
const meshIdsStack = [];
|
|
118169
|
-
let meshIds =
|
|
118148
|
+
let meshIds = [];
|
|
118170
118149
|
|
|
118171
118150
|
return function (ctx, node, depth, matrix) {
|
|
118172
118151
|
matrix = parseNodeMatrix(node, matrix);
|
|
@@ -118342,7 +118321,11 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
118342
118321
|
if (primitive.indices) {
|
|
118343
118322
|
meshCfg.indices = primitive.indices.value;
|
|
118344
118323
|
}
|
|
118345
|
-
|
|
118324
|
+
if (matrix) {
|
|
118325
|
+
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
118326
|
+
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
118327
|
+
meshCfg.positions.set(meshCfg.localPositions);
|
|
118328
|
+
}
|
|
118346
118329
|
const origin = math.vec3();
|
|
118347
118330
|
const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy
|
|
118348
118331
|
if (rtcNeeded) {
|
|
@@ -127067,7 +127050,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
127067
127050
|
this._nodeNodes[buildingNode.nodeId] = buildingNode;
|
|
127068
127051
|
} else if (metaObjectType === "IfcBuildingStorey") {
|
|
127069
127052
|
if (!buildingNode) {
|
|
127070
|
-
this.error("Failed to build storeys hierarchy for model
|
|
127053
|
+
this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");
|
|
127071
127054
|
return;
|
|
127072
127055
|
}
|
|
127073
127056
|
storeyNode = {
|
|
@@ -132464,6 +132447,9 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
132464
132447
|
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
|
|
132465
132448
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
132466
132449
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
132450
|
+
* @param {Number} [params.renderOrder=0] Specifies the rendering order for the model. This is used to control the order in which
|
|
132451
|
+
* SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
|
|
132452
|
+
* render pass.
|
|
132467
132453
|
* @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}.
|
|
132468
132454
|
*/
|
|
132469
132455
|
load(params = {}) {
|
|
@@ -132513,7 +132499,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
132513
132499
|
origin: params.origin,
|
|
132514
132500
|
disableVertexWelding: params.disableVertexWelding || false,
|
|
132515
132501
|
disableIndexRebucketing: params.disableIndexRebucketing || false,
|
|
132516
|
-
dtxEnabled: params.dtxEnabled
|
|
132502
|
+
dtxEnabled: params.dtxEnabled,
|
|
132503
|
+
renderOrder: params.renderOrder
|
|
132517
132504
|
}));
|
|
132518
132505
|
|
|
132519
132506
|
const modelId = sceneModel.id; // In case ID was auto-generated
|
|
@@ -139254,49 +139241,126 @@ class DotBIMLoaderPlugin extends Plugin {
|
|
|
139254
139241
|
|
|
139255
139242
|
const dbMeshId = element.mesh_id;
|
|
139256
139243
|
|
|
139257
|
-
parseDBMesh(dbMeshId);
|
|
139258
|
-
|
|
139259
|
-
const meshId = `${objectId}-mesh`;
|
|
139260
139244
|
const vector = element.vector;
|
|
139261
139245
|
const rotation = element.rotation;
|
|
139262
139246
|
const props = objectDefaults ? objectDefaults[elementType] || objectDefaults["DEFAULT"] : null;
|
|
139263
|
-
|
|
139264
139247
|
let visible = true;
|
|
139265
139248
|
let pickable = true;
|
|
139266
|
-
let color = element.color ? [element.color.r / 255, element.color.g / 255, element.color.b / 255] : [1, 1, 1];
|
|
139267
|
-
let opacity = element.color ? element.color.a / 255 : 1.0;
|
|
139268
139249
|
|
|
139269
|
-
if (
|
|
139270
|
-
|
|
139271
|
-
|
|
139272
|
-
|
|
139273
|
-
|
|
139274
|
-
|
|
139275
|
-
|
|
139276
|
-
|
|
139277
|
-
|
|
139278
|
-
|
|
139279
|
-
|
|
139280
|
-
|
|
139250
|
+
if (element.face_colors === undefined) {
|
|
139251
|
+
|
|
139252
|
+
parseDBMesh(dbMeshId);
|
|
139253
|
+
|
|
139254
|
+
const meshId = `${objectId}-mesh`;
|
|
139255
|
+
|
|
139256
|
+
let color = element.color ? [element.color.r / 255.0, element.color.g / 255.0, element.color.b / 255.0] : [1, 1, 1];
|
|
139257
|
+
let opacity = element.color ? element.color.a / 255.0 : 1.0;
|
|
139258
|
+
|
|
139259
|
+
if (props) {
|
|
139260
|
+
if (props.visible === false) {
|
|
139261
|
+
visible = false;
|
|
139262
|
+
}
|
|
139263
|
+
if (props.pickable === false) {
|
|
139264
|
+
pickable = false;
|
|
139265
|
+
}
|
|
139266
|
+
if (props.colorize) {
|
|
139267
|
+
color = props.colorize;
|
|
139268
|
+
}
|
|
139269
|
+
if (props.opacity !== undefined && props.opacity !== null) {
|
|
139270
|
+
opacity = props.opacity;
|
|
139271
|
+
}
|
|
139281
139272
|
}
|
|
139273
|
+
|
|
139274
|
+
sceneModel.createMesh({
|
|
139275
|
+
id: meshId,
|
|
139276
|
+
geometryId: dbMeshId,
|
|
139277
|
+
color: color,
|
|
139278
|
+
opacity: opacity,
|
|
139279
|
+
quaternion: rotation && (rotation.qz !== 0 || rotation.qy !== 0 || rotation.qx !== 0 || rotation.qw !== 1.0) ? [rotation.qx, rotation.qy, rotation.qz, rotation.qw] : undefined,
|
|
139280
|
+
position: vector ? [vector.x, vector.y, vector.z] : undefined
|
|
139281
|
+
});
|
|
139282
|
+
|
|
139283
|
+
sceneModel.createEntity({
|
|
139284
|
+
id: objectId,
|
|
139285
|
+
meshIds: [meshId],
|
|
139286
|
+
visible: visible,
|
|
139287
|
+
pickable: pickable,
|
|
139288
|
+
isObject: true
|
|
139289
|
+
});
|
|
139282
139290
|
}
|
|
139291
|
+
else {
|
|
139292
|
+
let faceColors = element.face_colors;
|
|
139293
|
+
let coloredTrianglesDictionary = {};
|
|
139294
|
+
let currentTriangleIndicesCount = 0;
|
|
139295
|
+
let dbMesh = fileData.meshes[element.mesh_id];
|
|
139296
|
+
for (let i = 0, len = faceColors.length; i < len; i+=4) {
|
|
139297
|
+
let faceColor = [faceColors[i], faceColors[i+1], faceColors[i+2], faceColors[i+3]];
|
|
139298
|
+
if (coloredTrianglesDictionary[faceColor] === undefined) {
|
|
139299
|
+
coloredTrianglesDictionary[faceColor] = [];
|
|
139300
|
+
}
|
|
139301
|
+
let indexForPoint0 = dbMesh.indices[currentTriangleIndicesCount];
|
|
139302
|
+
let x0 = dbMesh.coordinates[indexForPoint0*3];
|
|
139303
|
+
let y0 = dbMesh.coordinates[indexForPoint0*3+1];
|
|
139304
|
+
let z0 = dbMesh.coordinates[indexForPoint0*3+2];
|
|
139305
|
+
let indexForPoint1 = dbMesh.indices[currentTriangleIndicesCount+1];
|
|
139306
|
+
let x1 = dbMesh.coordinates[indexForPoint1*3];
|
|
139307
|
+
let y1 = dbMesh.coordinates[indexForPoint1*3+1];
|
|
139308
|
+
let z1 = dbMesh.coordinates[indexForPoint1*3+2];
|
|
139309
|
+
let indexForPoint2 = dbMesh.indices[currentTriangleIndicesCount+2];
|
|
139310
|
+
let x2 = dbMesh.coordinates[indexForPoint2*3];
|
|
139311
|
+
let y2 = dbMesh.coordinates[indexForPoint2*3+1];
|
|
139312
|
+
let z2 = dbMesh.coordinates[indexForPoint2*3+2];
|
|
139313
|
+
coloredTrianglesDictionary[faceColor].push(x0, y0, z0, x1, y1, z1, x2, y2, z2);
|
|
139314
|
+
|
|
139315
|
+
currentTriangleIndicesCount += 3;
|
|
139316
|
+
}
|
|
139317
|
+
let meshIds = [];
|
|
139318
|
+
for (const [faceColor, trianglesCoordinates] of Object.entries(coloredTrianglesDictionary)) {
|
|
139319
|
+
sceneModel.createGeometry({
|
|
139320
|
+
id: `${dbMeshId}-${faceColor}`,
|
|
139321
|
+
primitive: "triangles",
|
|
139322
|
+
positions: trianglesCoordinates,
|
|
139323
|
+
indices: [...Array(trianglesCoordinates.length).keys()]
|
|
139324
|
+
});
|
|
139325
|
+
const meshId = `${objectId}-mesh-${faceColor}`;
|
|
139326
|
+
const faceColorArray = faceColor.split(',').map(Number);
|
|
139283
139327
|
|
|
139284
|
-
|
|
139285
|
-
|
|
139286
|
-
geometryId: dbMeshId,
|
|
139287
|
-
color,
|
|
139288
|
-
opacity,
|
|
139289
|
-
quaternion: rotation && (rotation.qz !== 0 || rotation.qy !== 0 || rotation.qx !== 0 || rotation.qw !== 1.0) ? [rotation.qx, rotation.qy, rotation.qz, rotation.qw] : undefined,
|
|
139290
|
-
position: vector ? [vector.x, vector.y, vector.z] : undefined
|
|
139291
|
-
});
|
|
139328
|
+
let color = [faceColorArray[0] / 255.0, faceColorArray[1] / 255.0, faceColorArray[2] / 255.0];
|
|
139329
|
+
let opacity = faceColorArray[3] / 255.0;
|
|
139292
139330
|
|
|
139293
|
-
|
|
139294
|
-
|
|
139295
|
-
|
|
139296
|
-
|
|
139297
|
-
|
|
139298
|
-
|
|
139299
|
-
|
|
139331
|
+
if (props) {
|
|
139332
|
+
if (props.visible === false) {
|
|
139333
|
+
visible = false;
|
|
139334
|
+
}
|
|
139335
|
+
if (props.pickable === false) {
|
|
139336
|
+
pickable = false;
|
|
139337
|
+
}
|
|
139338
|
+
if (props.colorize) {
|
|
139339
|
+
color = props.colorize;
|
|
139340
|
+
}
|
|
139341
|
+
if (props.opacity !== undefined && props.opacity !== null) {
|
|
139342
|
+
opacity = props.opacity;
|
|
139343
|
+
}
|
|
139344
|
+
}
|
|
139345
|
+
|
|
139346
|
+
sceneModel.createMesh({
|
|
139347
|
+
id: meshId,
|
|
139348
|
+
geometryId: `${dbMeshId}-${faceColor}`,
|
|
139349
|
+
color: color,
|
|
139350
|
+
opacity: opacity,
|
|
139351
|
+
quaternion: rotation && (rotation.qz !== 0 || rotation.qy !== 0 || rotation.qx !== 0 || rotation.qw !== 1.0) ? [rotation.qx, rotation.qy, rotation.qz, rotation.qw] : undefined,
|
|
139352
|
+
position: vector ? [vector.x, vector.y, vector.z] : undefined
|
|
139353
|
+
});
|
|
139354
|
+
meshIds.push(meshId);
|
|
139355
|
+
}
|
|
139356
|
+
sceneModel.createEntity({
|
|
139357
|
+
id: objectId,
|
|
139358
|
+
meshIds: meshIds,
|
|
139359
|
+
visible: visible,
|
|
139360
|
+
pickable: pickable,
|
|
139361
|
+
isObject: true
|
|
139362
|
+
});
|
|
139363
|
+
}
|
|
139300
139364
|
|
|
139301
139365
|
for (let infoKey in info) {
|
|
139302
139366
|
let properties;
|
|
@@ -139642,10 +139706,9 @@ const basePolygon3D = function(scene, color, alpha) {
|
|
|
139642
139706
|
};
|
|
139643
139707
|
};
|
|
139644
139708
|
|
|
139645
|
-
const
|
|
139646
|
-
const marker1 = marker3D(scene,
|
|
139647
|
-
const marker2 = marker3D(scene,
|
|
139648
|
-
const basePolygon = basePolygon3D(scene, zoneColor, zoneAlpha);
|
|
139709
|
+
const startAARectCreateUI = function(scene, markersColor, pointerLens, select3dPoint, withPoints, onPointsSelected) {
|
|
139710
|
+
const marker1 = marker3D(scene, markersColor);
|
|
139711
|
+
const marker2 = marker3D(scene, markersColor);
|
|
139649
139712
|
|
|
139650
139713
|
const updatePointerLens = (pointerLens
|
|
139651
139714
|
? function(canvasPos) {
|
|
@@ -139673,29 +139736,14 @@ const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor,
|
|
|
139673
139736
|
function() {
|
|
139674
139737
|
updatePointerLens(null);
|
|
139675
139738
|
marker2.update(null);
|
|
139676
|
-
|
|
139739
|
+
withPoints(null);
|
|
139677
139740
|
},
|
|
139678
139741
|
function(canvasPos, point2WorldPos) {
|
|
139679
139742
|
updatePointerLens(canvasPos);
|
|
139680
139743
|
marker2.update(point2WorldPos);
|
|
139681
|
-
|
|
139682
|
-
|
|
139683
|
-
|
|
139684
|
-
const min = (idx) => Math.min(point1WorldPos[idx], point2WorldPos[idx]);
|
|
139685
|
-
const max = (idx) => Math.max(point1WorldPos[idx], point2WorldPos[idx]);
|
|
139686
|
-
|
|
139687
|
-
const xmin = min(0);
|
|
139688
|
-
const ymin = min(1);
|
|
139689
|
-
const zmin = min(2);
|
|
139690
|
-
const xmax = max(0);
|
|
139691
|
-
max(1);
|
|
139692
|
-
const zmax = max(2);
|
|
139693
|
-
|
|
139694
|
-
basePolygon.updateBase([ [ xmin, ymin, zmax ], [ xmax, ymin, zmax ],
|
|
139695
|
-
[ xmax, ymin, zmin ], [ xmin, ymin, zmin ] ]);
|
|
139696
|
-
}
|
|
139697
|
-
else
|
|
139698
|
-
basePolygon.updateBase(null);
|
|
139744
|
+
withPoints((math.distVec3(point1WorldPos, point2WorldPos) > 0.01)
|
|
139745
|
+
&&
|
|
139746
|
+
[ point1WorldPos, point2WorldPos ]);
|
|
139699
139747
|
},
|
|
139700
139748
|
function(point2CanvasPos, point2WorldPos) {
|
|
139701
139749
|
// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
@@ -139705,35 +139753,9 @@ const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor,
|
|
|
139705
139753
|
|
|
139706
139754
|
marker1.destroy();
|
|
139707
139755
|
marker2.destroy();
|
|
139708
|
-
basePolygon.destroy();
|
|
139709
139756
|
updatePointerLens(null);
|
|
139710
139757
|
|
|
139711
|
-
|
|
139712
|
-
const max = (idx) => Math.max(point1WorldPos[idx], point2WorldPos[idx]);
|
|
139713
|
-
|
|
139714
|
-
const xmin = min(0);
|
|
139715
|
-
const zmin = min(2);
|
|
139716
|
-
const xmax = max(0);
|
|
139717
|
-
const zmax = max(2);
|
|
139718
|
-
|
|
139719
|
-
const zone = zonesPlugin.createZone(
|
|
139720
|
-
{
|
|
139721
|
-
id: math.createUUID(),
|
|
139722
|
-
geometry: {
|
|
139723
|
-
planeCoordinates: [
|
|
139724
|
-
[ xmin, zmax ],
|
|
139725
|
-
[ xmax, zmax ],
|
|
139726
|
-
[ xmax, zmin ],
|
|
139727
|
-
[ xmin, zmin ]
|
|
139728
|
-
],
|
|
139729
|
-
altitude: zoneAltitude,
|
|
139730
|
-
height: zoneHeight
|
|
139731
|
-
},
|
|
139732
|
-
alpha: zoneAlpha,
|
|
139733
|
-
color: zoneColor
|
|
139734
|
-
});
|
|
139735
|
-
|
|
139736
|
-
onZoneCreated(zone);
|
|
139758
|
+
onPointsSelected([ point1WorldPos, point2WorldPos ]);
|
|
139737
139759
|
});
|
|
139738
139760
|
});
|
|
139739
139761
|
|
|
@@ -139742,7 +139764,6 @@ const startAAZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor,
|
|
|
139742
139764
|
deactivatePointSelection();
|
|
139743
139765
|
marker1.destroy();
|
|
139744
139766
|
marker2.destroy();
|
|
139745
|
-
basePolygon.destroy();
|
|
139746
139767
|
updatePointerLens(null);
|
|
139747
139768
|
}
|
|
139748
139769
|
};
|
|
@@ -140402,6 +140423,34 @@ class Zone extends Component {
|
|
|
140402
140423
|
}
|
|
140403
140424
|
}
|
|
140404
140425
|
|
|
140426
|
+
const createAAZoneFromPoints = function(pos1, pos2, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, zonesPlugin) {
|
|
140427
|
+
|
|
140428
|
+
const min = (idx) => Math.min(pos1[idx], pos2[idx]);
|
|
140429
|
+
const max = (idx) => Math.max(pos1[idx], pos2[idx]);
|
|
140430
|
+
|
|
140431
|
+
const xmin = min(0);
|
|
140432
|
+
const zmin = min(2);
|
|
140433
|
+
const xmax = max(0);
|
|
140434
|
+
const zmax = max(2);
|
|
140435
|
+
|
|
140436
|
+
return zonesPlugin.createZone(
|
|
140437
|
+
{
|
|
140438
|
+
id: math.createUUID(),
|
|
140439
|
+
geometry: {
|
|
140440
|
+
planeCoordinates: [
|
|
140441
|
+
[ xmin, zmax ],
|
|
140442
|
+
[ xmax, zmax ],
|
|
140443
|
+
[ xmax, zmin ],
|
|
140444
|
+
[ xmin, zmin ]
|
|
140445
|
+
],
|
|
140446
|
+
altitude: zoneAltitude,
|
|
140447
|
+
height: zoneHeight
|
|
140448
|
+
},
|
|
140449
|
+
alpha: zoneAlpha,
|
|
140450
|
+
color: zoneColor
|
|
140451
|
+
});
|
|
140452
|
+
};
|
|
140453
|
+
|
|
140405
140454
|
/**
|
|
140406
140455
|
* Creates {@link Zone}s in a {@link ZonesPlugin} from mouse input.
|
|
140407
140456
|
*
|
|
@@ -140432,7 +140481,7 @@ class Zone extends Component {
|
|
|
140432
140481
|
* const zonesControl = new ZonesMouseControl(Zones)
|
|
140433
140482
|
* ````
|
|
140434
140483
|
*/
|
|
140435
|
-
class
|
|
140484
|
+
class ZonesAAZoneControl extends Component {
|
|
140436
140485
|
|
|
140437
140486
|
/**
|
|
140438
140487
|
* Creates a ZonesMouseControl bound to the given ZonesPlugin.
|
|
@@ -140441,11 +140490,12 @@ class ZonesMouseControl extends Component {
|
|
|
140441
140490
|
* @param [cfg] Configuration
|
|
140442
140491
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
140443
140492
|
*/
|
|
140444
|
-
constructor(zonesPlugin, cfg
|
|
140493
|
+
constructor(zonesPlugin, cfg, createSelect3dPoint) {
|
|
140445
140494
|
super(zonesPlugin.viewer.scene);
|
|
140446
140495
|
|
|
140447
140496
|
this.zonesPlugin = zonesPlugin;
|
|
140448
140497
|
this.pointerLens = cfg.pointerLens;
|
|
140498
|
+
this.createSelect3dPoint = createSelect3dPoint;
|
|
140449
140499
|
this._deactivate = null;
|
|
140450
140500
|
}
|
|
140451
140501
|
|
|
@@ -140482,16 +140532,35 @@ class ZonesMouseControl extends Component {
|
|
|
140482
140532
|
const scene = viewer.scene;
|
|
140483
140533
|
const self = this;
|
|
140484
140534
|
|
|
140485
|
-
const select3dPoint =
|
|
140486
|
-
viewer,
|
|
140487
|
-
function(origin, direction) {
|
|
140488
|
-
return planeIntersect(zoneAltitude, math.vec3([ 0, 1, 0 ]), origin, direction);
|
|
140489
|
-
});
|
|
140535
|
+
const select3dPoint = this.createSelect3dPoint(viewer, (origin, direction) => planeIntersect(zoneAltitude, math.vec3([ 0, 1, 0 ]), origin, direction));
|
|
140490
140536
|
|
|
140491
140537
|
(function rec() {
|
|
140492
|
-
|
|
140493
|
-
|
|
140494
|
-
|
|
140538
|
+
const basePolygon = basePolygon3D(scene, zoneColor, zoneAlpha);
|
|
140539
|
+
const deactivate = startAARectCreateUI(
|
|
140540
|
+
scene, zoneColor, self.pointerLens, select3dPoint,
|
|
140541
|
+
points => {
|
|
140542
|
+
if (points) {
|
|
140543
|
+
const p0 = points[0];
|
|
140544
|
+
const p1 = points[1];
|
|
140545
|
+
const min = (idx) => Math.min(p0[idx], p1[idx]);
|
|
140546
|
+
const max = (idx) => Math.max(p0[idx], p1[idx]);
|
|
140547
|
+
|
|
140548
|
+
const xmin = min(0);
|
|
140549
|
+
const ymin = min(1);
|
|
140550
|
+
const zmin = min(2);
|
|
140551
|
+
const xmax = max(0);
|
|
140552
|
+
max(1);
|
|
140553
|
+
const zmax = max(2);
|
|
140554
|
+
|
|
140555
|
+
basePolygon.updateBase([ [ xmin, ymin, zmax ], [ xmax, ymin, zmax ],
|
|
140556
|
+
[ xmax, ymin, zmin ], [ xmin, ymin, zmin ] ]);
|
|
140557
|
+
} else {
|
|
140558
|
+
basePolygon.updateBase(null);
|
|
140559
|
+
}
|
|
140560
|
+
},
|
|
140561
|
+
points => {
|
|
140562
|
+
basePolygon.destroy();
|
|
140563
|
+
const zone = createAAZoneFromPoints(points[0], points[1], zoneAltitude, zoneHeight, zoneColor, zoneAlpha, zonesPlugin);
|
|
140495
140564
|
let reactivate = true;
|
|
140496
140565
|
self._deactivate = () => { reactivate = false; };
|
|
140497
140566
|
self.fire("zoneEnd", zone);
|
|
@@ -140500,6 +140569,10 @@ class ZonesMouseControl extends Component {
|
|
|
140500
140569
|
rec();
|
|
140501
140570
|
}
|
|
140502
140571
|
}).deactivate;
|
|
140572
|
+
self._deactivate = () => {
|
|
140573
|
+
deactivate();
|
|
140574
|
+
basePolygon.destroy();
|
|
140575
|
+
};
|
|
140503
140576
|
})();
|
|
140504
140577
|
}
|
|
140505
140578
|
|
|
@@ -140522,6 +140595,30 @@ class ZonesMouseControl extends Component {
|
|
|
140522
140595
|
}
|
|
140523
140596
|
}
|
|
140524
140597
|
|
|
140598
|
+
class ZonesMouseControl extends ZonesAAZoneControl {
|
|
140599
|
+
constructor(zonesPlugin, cfg = {}) {
|
|
140600
|
+
super(
|
|
140601
|
+
zonesPlugin,
|
|
140602
|
+
cfg,
|
|
140603
|
+
(viewer, ray2WorldPos) => mousePointSelector(viewer, ray2WorldPos));
|
|
140604
|
+
}
|
|
140605
|
+
}
|
|
140606
|
+
class ZonesTouchControl extends ZonesAAZoneControl {
|
|
140607
|
+
constructor(zonesPlugin, cfg = {}) {
|
|
140608
|
+
const pointerCircle = new PointerCircle(zonesPlugin.viewer);
|
|
140609
|
+
super(
|
|
140610
|
+
zonesPlugin,
|
|
140611
|
+
cfg,
|
|
140612
|
+
(viewer, ray2WorldPos) => touchPointSelector(viewer, pointerCircle, ray2WorldPos));
|
|
140613
|
+
this.pointerCircle = pointerCircle;
|
|
140614
|
+
}
|
|
140615
|
+
|
|
140616
|
+
destroy() {
|
|
140617
|
+
this.pointerCircle.destroy();
|
|
140618
|
+
super.destroy();
|
|
140619
|
+
}
|
|
140620
|
+
}
|
|
140621
|
+
|
|
140525
140622
|
/**
|
|
140526
140623
|
* ZonesPlugin documentation to be added, mostly compatible with DistanceMeasurementsPlugin.
|
|
140527
140624
|
*/
|
|
@@ -140636,86 +140733,6 @@ class ZonesPlugin extends Plugin {
|
|
|
140636
140733
|
}
|
|
140637
140734
|
}
|
|
140638
140735
|
|
|
140639
|
-
class ZonesTouchControl extends Component {
|
|
140640
|
-
|
|
140641
|
-
constructor(zonesPlugin, cfg = {}) {
|
|
140642
|
-
super(zonesPlugin.viewer.scene);
|
|
140643
|
-
|
|
140644
|
-
this.zonesPlugin = zonesPlugin;
|
|
140645
|
-
this.pointerLens = cfg.pointerLens;
|
|
140646
|
-
this.pointerCircle = new PointerCircle(zonesPlugin.viewer);
|
|
140647
|
-
this._deactivate = null;
|
|
140648
|
-
}
|
|
140649
|
-
|
|
140650
|
-
get active() {
|
|
140651
|
-
return !! this._deactivate;
|
|
140652
|
-
}
|
|
140653
|
-
|
|
140654
|
-
activate(zoneAltitude, zoneHeight, zoneColor, zoneAlpha) {
|
|
140655
|
-
|
|
140656
|
-
if (typeof(zoneAltitude) === "object" && (zoneAltitude !== null)) {
|
|
140657
|
-
const params = zoneAltitude;
|
|
140658
|
-
const param = (name, defaultValue) => {
|
|
140659
|
-
if (name in params) {
|
|
140660
|
-
return params[name];
|
|
140661
|
-
} else if (defaultValue !== undefined) {
|
|
140662
|
-
return defaultValue;
|
|
140663
|
-
} else {
|
|
140664
|
-
throw "config missing: " + name;
|
|
140665
|
-
}
|
|
140666
|
-
};
|
|
140667
|
-
|
|
140668
|
-
zoneAltitude = param("altitude");
|
|
140669
|
-
zoneHeight = param("height");
|
|
140670
|
-
zoneColor = param("color", "#008000");
|
|
140671
|
-
zoneAlpha = param("alpha", 0.5);
|
|
140672
|
-
}
|
|
140673
|
-
|
|
140674
|
-
if (this._deactivate) {
|
|
140675
|
-
return;
|
|
140676
|
-
}
|
|
140677
|
-
|
|
140678
|
-
const zonesPlugin = this.zonesPlugin;
|
|
140679
|
-
const viewer = zonesPlugin.viewer;
|
|
140680
|
-
const scene = viewer.scene;
|
|
140681
|
-
const self = this;
|
|
140682
|
-
|
|
140683
|
-
const select3dPoint = touchPointSelector(
|
|
140684
|
-
viewer,
|
|
140685
|
-
this.pointerCircle,
|
|
140686
|
-
function(origin, direction) {
|
|
140687
|
-
return planeIntersect(zoneAltitude, math.vec3([ 0, 1, 0 ]), origin, direction);
|
|
140688
|
-
});
|
|
140689
|
-
|
|
140690
|
-
(function rec() {
|
|
140691
|
-
self._deactivate = startAAZoneCreateUI(
|
|
140692
|
-
scene, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, self.pointerLens, zonesPlugin, select3dPoint,
|
|
140693
|
-
zone => {
|
|
140694
|
-
let reactivate = true;
|
|
140695
|
-
self._deactivate = () => { reactivate = false; };
|
|
140696
|
-
self.fire("zoneEnd", zone);
|
|
140697
|
-
if (reactivate)
|
|
140698
|
-
{
|
|
140699
|
-
rec();
|
|
140700
|
-
}
|
|
140701
|
-
}).deactivate;
|
|
140702
|
-
})();
|
|
140703
|
-
}
|
|
140704
|
-
|
|
140705
|
-
deactivate() {
|
|
140706
|
-
if (this._deactivate)
|
|
140707
|
-
{
|
|
140708
|
-
this._deactivate();
|
|
140709
|
-
this._deactivate = null;
|
|
140710
|
-
}
|
|
140711
|
-
}
|
|
140712
|
-
|
|
140713
|
-
destroy() {
|
|
140714
|
-
this.deactivate();
|
|
140715
|
-
super.destroy();
|
|
140716
|
-
}
|
|
140717
|
-
}
|
|
140718
|
-
|
|
140719
140736
|
const startPolysurfaceZoneCreateUI = function(scene, zoneAltitude, zoneHeight, zoneColor, zoneAlpha, pointerLens, zonesPlugin, select3dPoint, onZoneCreated) {
|
|
140720
140737
|
const updatePointerLens = (pointerLens
|
|
140721
140738
|
? function(canvasPos) {
|