@xeokit/xeokit-sdk 2.6.5 → 2.6.7
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 +20 -14
- package/dist/xeokit-sdk.cjs.js +427 -169
- package/dist/xeokit-sdk.es.js +427 -169
- package/dist/xeokit-sdk.es5.js +896 -746
- 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/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +47 -52
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +22 -23
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +40 -47
- package/src/viewer/scene/model/SceneModelTransform.js +1 -1
- package/src/viewer/scene/model/vbo/VBORenderer.js +10 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js +2 -2
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js +3 -3
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +14 -8
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js +10 -4
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +10 -4
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js +16 -8
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js +1 -2
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +10 -4
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js +12 -6
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +17 -11
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js +15 -6
- package/src/viewer/scene/postfx/CrossSections.js +203 -0
- package/src/viewer/scene/scene/Scene.js +10 -1
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +9 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +1 -2
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +4 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +92 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +1 -1
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +13 -2
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +70 -0
- package/types/viewer/scene/postfx/CrossSections.d.ts +42 -0
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -13082,8 +13082,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13082
13082
|
this._onCanvasTouchStart = null;
|
|
13083
13083
|
this._onCanvasTouchEnd = null;
|
|
13084
13084
|
this._longTouchTimeoutMs = 300;
|
|
13085
|
-
this.
|
|
13086
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
13085
|
+
this._snapping = cfg.snapping !== false;
|
|
13087
13086
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13088
13087
|
|
|
13089
13088
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
@@ -13113,39 +13112,35 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13113
13112
|
}
|
|
13114
13113
|
|
|
13115
13114
|
/**
|
|
13116
|
-
* Sets whether snap-to-vertex
|
|
13117
|
-
*
|
|
13118
|
-
* @param snapToVertex
|
|
13119
|
-
*/
|
|
13120
|
-
set snapToVertex(snapToVertex) {
|
|
13121
|
-
this._snapToVertex = snapToVertex;
|
|
13122
|
-
}
|
|
13123
|
-
|
|
13124
|
-
/**
|
|
13125
|
-
* Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
|
|
13126
|
-
* This is `true` by default.
|
|
13127
|
-
* @returns {*}
|
|
13128
|
-
*/
|
|
13129
|
-
get snapToVertex() {
|
|
13130
|
-
return this._snapToVertex;
|
|
13131
|
-
}
|
|
13132
|
-
|
|
13133
|
-
/**
|
|
13134
|
-
* Sets whether snap-to-edge is enabled for this AngleMeasurementsTouchControl.
|
|
13115
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13116
|
+
*
|
|
13135
13117
|
* This is `true` by default.
|
|
13136
|
-
*
|
|
13118
|
+
*
|
|
13119
|
+
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
13120
|
+
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
13121
|
+
* and rebinds various input handlers.
|
|
13122
|
+
*
|
|
13123
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
13137
13124
|
*/
|
|
13138
|
-
set
|
|
13139
|
-
this.
|
|
13125
|
+
set snapping(snapping) {
|
|
13126
|
+
if (snapping !== this._snapping) {
|
|
13127
|
+
this._snapping = snapping;
|
|
13128
|
+
this.deactivate();
|
|
13129
|
+
this.activate();
|
|
13130
|
+
} else {
|
|
13131
|
+
this._snapping = snapping;
|
|
13132
|
+
}
|
|
13140
13133
|
}
|
|
13141
13134
|
|
|
13142
13135
|
/**
|
|
13143
|
-
* Gets whether snap-to-edge
|
|
13136
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13137
|
+
*
|
|
13144
13138
|
* This is `true` by default.
|
|
13145
|
-
*
|
|
13139
|
+
*
|
|
13140
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13146
13141
|
*/
|
|
13147
|
-
get
|
|
13148
|
-
return this.
|
|
13142
|
+
get snapping() {
|
|
13143
|
+
return this._snapping;
|
|
13149
13144
|
}
|
|
13150
13145
|
|
|
13151
13146
|
/**
|
|
@@ -13175,11 +13170,11 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13175
13170
|
|
|
13176
13171
|
let touchId = null;
|
|
13177
13172
|
|
|
13178
|
-
const
|
|
13173
|
+
const disableCameraNavigation = () => {
|
|
13179
13174
|
this.plugin.viewer.cameraControl.active = false;
|
|
13180
13175
|
};
|
|
13181
13176
|
|
|
13182
|
-
const
|
|
13177
|
+
const enableCameraNavigation = () => {
|
|
13183
13178
|
this.plugin.viewer.cameraControl.active = true;
|
|
13184
13179
|
};
|
|
13185
13180
|
|
|
@@ -13192,7 +13187,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13192
13187
|
this._currentAngleMeasurement.destroy();
|
|
13193
13188
|
this._currentAngleMeasurement = null;
|
|
13194
13189
|
}
|
|
13195
|
-
|
|
13190
|
+
enableCameraNavigation();
|
|
13196
13191
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13197
13192
|
};
|
|
13198
13193
|
|
|
@@ -13224,8 +13219,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13224
13219
|
}
|
|
13225
13220
|
const snapPickResult = scene.pick({
|
|
13226
13221
|
canvasPos: touchMoveCanvasPos,
|
|
13227
|
-
snapToVertex: this.
|
|
13228
|
-
snapToEdge: this.
|
|
13222
|
+
snapToVertex: this._snapping,
|
|
13223
|
+
snapToEdge: this._snapping
|
|
13229
13224
|
});
|
|
13230
13225
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13231
13226
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -13299,7 +13294,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13299
13294
|
// }
|
|
13300
13295
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;
|
|
13301
13296
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
13302
|
-
|
|
13297
|
+
disableCameraNavigation();
|
|
13303
13298
|
}, this._longTouchTimeoutMs);
|
|
13304
13299
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1;
|
|
13305
13300
|
//console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -13336,8 +13331,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13336
13331
|
|
|
13337
13332
|
const snapPickResult = scene.pick({
|
|
13338
13333
|
canvasPos: touchMoveCanvasPos,
|
|
13339
|
-
snapToVertex: this.
|
|
13340
|
-
snapToEdge: this.
|
|
13334
|
+
snapToVertex: this._snapping,
|
|
13335
|
+
snapToEdge: this._snapping
|
|
13341
13336
|
});
|
|
13342
13337
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13343
13338
|
if (this.pointerLens) {
|
|
@@ -13389,7 +13384,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13389
13384
|
this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
|
|
13390
13385
|
// console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
|
|
13391
13386
|
|
|
13392
|
-
|
|
13387
|
+
disableCameraNavigation();
|
|
13393
13388
|
|
|
13394
13389
|
}, this._longTouchTimeoutMs);
|
|
13395
13390
|
|
|
@@ -13429,8 +13424,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13429
13424
|
|
|
13430
13425
|
const snapPickResult = scene.pick({
|
|
13431
13426
|
canvasPos: touchMoveCanvasPos,
|
|
13432
|
-
snapToVertex: this.
|
|
13433
|
-
snapToEdge: this.
|
|
13427
|
+
snapToVertex: this._snapping,
|
|
13428
|
+
snapToEdge: this._snapping
|
|
13434
13429
|
});
|
|
13435
13430
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13436
13431
|
if (this.pointerLens) {
|
|
@@ -13482,7 +13477,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13482
13477
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END$1;
|
|
13483
13478
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
13484
13479
|
|
|
13485
|
-
|
|
13480
|
+
disableCameraNavigation();
|
|
13486
13481
|
|
|
13487
13482
|
}, this._longTouchTimeoutMs);
|
|
13488
13483
|
|
|
@@ -13543,8 +13538,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13543
13538
|
}
|
|
13544
13539
|
snapPickResult = scene.pick({
|
|
13545
13540
|
canvasPos: touchMoveCanvasPos,
|
|
13546
|
-
snapToVertex: this.
|
|
13547
|
-
snapToEdge: this.
|
|
13541
|
+
snapToVertex: this._snapping,
|
|
13542
|
+
snapToEdge: this._snapping
|
|
13548
13543
|
});
|
|
13549
13544
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
13550
13545
|
if (this.pointerLens) {
|
|
@@ -13592,8 +13587,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13592
13587
|
}
|
|
13593
13588
|
snapPickResult = scene.pick({
|
|
13594
13589
|
canvasPos: touchMoveCanvasPos,
|
|
13595
|
-
snapToVertex: this.
|
|
13596
|
-
snapToEdge: this.
|
|
13590
|
+
snapToVertex: this._snapping,
|
|
13591
|
+
snapToEdge: this._snapping
|
|
13597
13592
|
});
|
|
13598
13593
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13599
13594
|
if (this.pointerLens) {
|
|
@@ -13648,8 +13643,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13648
13643
|
}
|
|
13649
13644
|
snapPickResult = scene.pick({
|
|
13650
13645
|
canvasPos: touchMoveCanvasPos,
|
|
13651
|
-
snapToVertex: this.
|
|
13652
|
-
snapToEdge: this.
|
|
13646
|
+
snapToVertex: this._snapping,
|
|
13647
|
+
snapToEdge: this._snapping
|
|
13653
13648
|
});
|
|
13654
13649
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13655
13650
|
if (this.pointerLens) {
|
|
@@ -13761,7 +13756,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13761
13756
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13762
13757
|
}
|
|
13763
13758
|
}
|
|
13764
|
-
|
|
13759
|
+
enableCameraNavigation();
|
|
13765
13760
|
break;
|
|
13766
13761
|
|
|
13767
13762
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
@@ -13779,7 +13774,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13779
13774
|
this._touchState = WAITING_FOR_CORNER_TOUCH_START;
|
|
13780
13775
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
|
|
13781
13776
|
}
|
|
13782
|
-
|
|
13777
|
+
enableCameraNavigation();
|
|
13783
13778
|
break;
|
|
13784
13779
|
|
|
13785
13780
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
|
|
@@ -13816,7 +13811,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13816
13811
|
}
|
|
13817
13812
|
|
|
13818
13813
|
}
|
|
13819
|
-
|
|
13814
|
+
enableCameraNavigation();
|
|
13820
13815
|
break;
|
|
13821
13816
|
|
|
13822
13817
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
@@ -13825,7 +13820,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13825
13820
|
}
|
|
13826
13821
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START$1;
|
|
13827
13822
|
// console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13828
|
-
|
|
13823
|
+
enableCameraNavigation();
|
|
13829
13824
|
break;
|
|
13830
13825
|
|
|
13831
13826
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1: {
|
|
@@ -13861,7 +13856,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13861
13856
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13862
13857
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13863
13858
|
}
|
|
13864
|
-
|
|
13859
|
+
enableCameraNavigation();
|
|
13865
13860
|
break;
|
|
13866
13861
|
|
|
13867
13862
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
@@ -13882,7 +13877,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13882
13877
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13883
13878
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13884
13879
|
}
|
|
13885
|
-
|
|
13880
|
+
enableCameraNavigation();
|
|
13886
13881
|
break;
|
|
13887
13882
|
}
|
|
13888
13883
|
|
|
@@ -28406,6 +28401,206 @@ class SAO extends Component {
|
|
|
28406
28401
|
}
|
|
28407
28402
|
}
|
|
28408
28403
|
|
|
28404
|
+
/**
|
|
28405
|
+
* @desc Configures cross-section slices for a {@link Scene}.
|
|
28406
|
+
*
|
|
28407
|
+
* ## Overview
|
|
28408
|
+
*
|
|
28409
|
+
* Cross-sections allow to create an additional colored slice for used clipping planes. It is only a visual effect
|
|
28410
|
+
* calculated by shaders. It makes it easier to see the intersection between the model and the clipping plane this way.
|
|
28411
|
+
*
|
|
28412
|
+
* ## Usage
|
|
28413
|
+
*
|
|
28414
|
+
* In the example below, we'll configure CrossSections to manipulate the slice representation.
|
|
28415
|
+
*
|
|
28416
|
+
* ````javascript
|
|
28417
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28418
|
+
* // Import the modules we need for this example
|
|
28419
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28420
|
+
*
|
|
28421
|
+
* import {PhongMaterial, Viewer, math, SectionPlanesPlugin, XKTLoaderPlugin, Mesh, ReadableGeometry, buildPolylineGeometryFromCurve, SplineCurve} from "../../dist/xeokit-sdk.es.js";
|
|
28422
|
+
*
|
|
28423
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28424
|
+
* // Create a Viewer and arrange the camera
|
|
28425
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28426
|
+
*
|
|
28427
|
+
* const viewer = new Viewer({
|
|
28428
|
+
* canvasId: "myCanvas",
|
|
28429
|
+
* transparent: true
|
|
28430
|
+
* });
|
|
28431
|
+
*
|
|
28432
|
+
* viewer.camera.eye = [-2.341298674548419, 22.43987089731119, 7.236688436028655];
|
|
28433
|
+
* viewer.camera.look = [4.399999999999963, 3.7240000000000606, 8.899000000000006];
|
|
28434
|
+
* viewer.camera.up = [0.9102954845584759, 0.34781746407929504, 0.22446635042673466];
|
|
28435
|
+
*
|
|
28436
|
+
* const cameraControl = viewer.cameraControl;
|
|
28437
|
+
* cameraControl.navMode = "orbit";
|
|
28438
|
+
* cameraControl.followPointer = true;
|
|
28439
|
+
*
|
|
28440
|
+
* //----------------------------------------------------------------------------------------------------------------------
|
|
28441
|
+
* // Create a xeokit loader plugin, load a model, fit to view
|
|
28442
|
+
* //----------------------------------------------------------------------------------------------------------------------
|
|
28443
|
+
*
|
|
28444
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
|
28445
|
+
*
|
|
28446
|
+
* var t0 = performance.now();
|
|
28447
|
+
*
|
|
28448
|
+
* document.getElementById("time").innerHTML = "Loading model...";
|
|
28449
|
+
*
|
|
28450
|
+
* const sceneModel = xktLoader.load({
|
|
28451
|
+
* id: "myModel",
|
|
28452
|
+
* src: "../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt",
|
|
28453
|
+
* edges: true
|
|
28454
|
+
* });
|
|
28455
|
+
*
|
|
28456
|
+
* sceneModel.on("loaded", () => {
|
|
28457
|
+
* var t1 = performance.now();
|
|
28458
|
+
* document.getElementById("time").innerHTML = "Model loaded in " + Math.floor(t1 - t0) / 1000.0 + " seconds<br>Objects: " + sceneModel.numEntities;
|
|
28459
|
+
*
|
|
28460
|
+
* let path = new SplineCurve(viewer.scene, {
|
|
28461
|
+
* points: [
|
|
28462
|
+
* [0, 0, -10],
|
|
28463
|
+
* [0, 0, -3],
|
|
28464
|
+
* [10, 0, 10],
|
|
28465
|
+
* [10, 0, 30],
|
|
28466
|
+
* ],
|
|
28467
|
+
* });
|
|
28468
|
+
*
|
|
28469
|
+
* new Mesh(viewer.scene, {
|
|
28470
|
+
* geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({
|
|
28471
|
+
* id: "SplineCurve",
|
|
28472
|
+
* curve: path,
|
|
28473
|
+
* divisions: 50,
|
|
28474
|
+
* })),
|
|
28475
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
28476
|
+
* emissive: [1, 0, 0]
|
|
28477
|
+
* })
|
|
28478
|
+
* });
|
|
28479
|
+
*
|
|
28480
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28481
|
+
* // Create a moving SectionPlane, that moves through the table models
|
|
28482
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28483
|
+
*
|
|
28484
|
+
* const sectionPlanes = new SectionPlanesPlugin(viewer, {
|
|
28485
|
+
* overviewCanvasId: "mySectionPlanesOverviewCanvas",
|
|
28486
|
+
* overviewVisible: true
|
|
28487
|
+
* });
|
|
28488
|
+
*
|
|
28489
|
+
* let currentPoint = path.getPoint(0);
|
|
28490
|
+
* let currentDirection = path.getTangent(0);
|
|
28491
|
+
*
|
|
28492
|
+
* const sectionPlane = sectionPlanes.createSectionPlane({
|
|
28493
|
+
* id: "mySectionPlane",
|
|
28494
|
+
* pos: currentPoint,
|
|
28495
|
+
* dir: currentDirection
|
|
28496
|
+
* });
|
|
28497
|
+
*
|
|
28498
|
+
* sectionPlanes.showControl(sectionPlane.id);
|
|
28499
|
+
*
|
|
28500
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28501
|
+
* // Controlling SectionPlane position and direction
|
|
28502
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28503
|
+
*
|
|
28504
|
+
* let currentT = 0.0;
|
|
28505
|
+
* document.getElementById("section_path").oninput = function() {
|
|
28506
|
+
* currentT = Number(document.getElementById("section_path").value);
|
|
28507
|
+
* currentPoint = path.getPoint(currentT);
|
|
28508
|
+
* currentDirection = path.getTangent(currentT);
|
|
28509
|
+
* sectionPlane.pos = currentPoint;
|
|
28510
|
+
* sectionPlane.dir = currentDirection;
|
|
28511
|
+
* };
|
|
28512
|
+
*
|
|
28513
|
+
* window.viewer = viewer;
|
|
28514
|
+
*
|
|
28515
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28516
|
+
* // Controlling CrossSections settings
|
|
28517
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28518
|
+
*
|
|
28519
|
+
* viewer.scene.crossSections.sliceThickness = 0.05;
|
|
28520
|
+
* viewer.scene.crossSections.sliceColor = [0.0, 0.0, 0.0, 1.0];
|
|
28521
|
+
* });
|
|
28522
|
+
* ````
|
|
28523
|
+
*
|
|
28524
|
+
* [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/slicing/#SectionPlanesPlugin_Duplex_SectionPath_CrossSections)]
|
|
28525
|
+
*
|
|
28526
|
+
*/
|
|
28527
|
+
class CrossSections extends Component {
|
|
28528
|
+
|
|
28529
|
+
/** @private */
|
|
28530
|
+
constructor(owner, cfg = {}) {
|
|
28531
|
+
|
|
28532
|
+
super(owner, cfg);
|
|
28533
|
+
|
|
28534
|
+
this.sliceColor = cfg.sliceColor;
|
|
28535
|
+
this.sliceThickness = cfg.sliceThickness;
|
|
28536
|
+
}
|
|
28537
|
+
|
|
28538
|
+
/**
|
|
28539
|
+
* Sets the thickness of a slice created by a section.
|
|
28540
|
+
*
|
|
28541
|
+
* Default value is ````0.0````.
|
|
28542
|
+
*
|
|
28543
|
+
* @type {Number}
|
|
28544
|
+
*/
|
|
28545
|
+
set sliceThickness(value) {
|
|
28546
|
+
if (value === undefined || value === null) {
|
|
28547
|
+
value = 0.0;
|
|
28548
|
+
}
|
|
28549
|
+
if (this._sliceThickness === value) {
|
|
28550
|
+
return;
|
|
28551
|
+
}
|
|
28552
|
+
this._sliceThickness = value;
|
|
28553
|
+
this.glRedraw();
|
|
28554
|
+
}
|
|
28555
|
+
|
|
28556
|
+
/**
|
|
28557
|
+
* Gets the thickness of a slice created by a section.
|
|
28558
|
+
*
|
|
28559
|
+
* Default value is ````0.0````.
|
|
28560
|
+
*
|
|
28561
|
+
* @type {Number}
|
|
28562
|
+
*/
|
|
28563
|
+
get sliceThickness() {
|
|
28564
|
+
return this._sliceThickness;
|
|
28565
|
+
}
|
|
28566
|
+
|
|
28567
|
+
/**
|
|
28568
|
+
* Sets the color of a slice created by a section.
|
|
28569
|
+
*
|
|
28570
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
28571
|
+
*
|
|
28572
|
+
* @type {Number}
|
|
28573
|
+
*/
|
|
28574
|
+
set sliceColor(value) {
|
|
28575
|
+
if (value === undefined || value === null) {
|
|
28576
|
+
value = [0.0, 0.0, 0.0, 1.0];
|
|
28577
|
+
}
|
|
28578
|
+
if (this._sliceColor === value) {
|
|
28579
|
+
return;
|
|
28580
|
+
}
|
|
28581
|
+
this._sliceColor = value;
|
|
28582
|
+
this.glRedraw();
|
|
28583
|
+
}
|
|
28584
|
+
|
|
28585
|
+
/**
|
|
28586
|
+
* Gets the color of a slice created by a section.
|
|
28587
|
+
*
|
|
28588
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
28589
|
+
*
|
|
28590
|
+
* @type {Number}
|
|
28591
|
+
*/
|
|
28592
|
+
get sliceColor() {
|
|
28593
|
+
return this._sliceColor;
|
|
28594
|
+
}
|
|
28595
|
+
|
|
28596
|
+
/**
|
|
28597
|
+
* Destroys this component.
|
|
28598
|
+
*/
|
|
28599
|
+
destroy() {
|
|
28600
|
+
super.destroy();
|
|
28601
|
+
}
|
|
28602
|
+
}
|
|
28603
|
+
|
|
28409
28604
|
const PRESETS$1 = {
|
|
28410
28605
|
"default": {
|
|
28411
28606
|
pointSize: 4,
|
|
@@ -29792,6 +29987,14 @@ class Scene extends Component {
|
|
|
29792
29987
|
enabled: cfg.saoEnabled
|
|
29793
29988
|
});
|
|
29794
29989
|
|
|
29990
|
+
/** Configures Cross Sections for this Scene.
|
|
29991
|
+
* @type {CrossSections}
|
|
29992
|
+
* @final
|
|
29993
|
+
*/
|
|
29994
|
+
this.crossSections = new CrossSections(this, {
|
|
29995
|
+
|
|
29996
|
+
});
|
|
29997
|
+
|
|
29795
29998
|
this.ticksPerRender = cfg.ticksPerRender;
|
|
29796
29999
|
this.ticksPerOcclusionTest = cfg.ticksPerOcclusionTest;
|
|
29797
30000
|
this.passes = cfg.passes;
|
|
@@ -50054,6 +50257,10 @@ class VBORenderer {
|
|
|
50054
50257
|
const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
|
|
50055
50258
|
const baseIndex = layerIndex * numSectionPlanes;
|
|
50056
50259
|
const renderFlags = model.renderFlags;
|
|
50260
|
+
if (scene.crossSections) {
|
|
50261
|
+
gl.uniform4fv(this._uSliceColor, scene.crossSections.sliceColor);
|
|
50262
|
+
gl.uniform1f(this._uSliceThickness, scene.crossSections.sliceThickness);
|
|
50263
|
+
}
|
|
50057
50264
|
for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
|
|
50058
50265
|
const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
|
|
50059
50266
|
if (sectionPlaneUniforms) {
|
|
@@ -50215,6 +50422,11 @@ class VBORenderer {
|
|
|
50215
50422
|
|
|
50216
50423
|
this._uPointSize = program.getLocation("pointSize");
|
|
50217
50424
|
this._uNearPlaneHeight = program.getLocation("nearPlaneHeight");
|
|
50425
|
+
|
|
50426
|
+
if (scene.crossSections) {
|
|
50427
|
+
this._uSliceColor = program.getLocation("sliceColor");
|
|
50428
|
+
this._uSliceThickness = program.getLocation("sliceThickness");
|
|
50429
|
+
}
|
|
50218
50430
|
}
|
|
50219
50431
|
|
|
50220
50432
|
_bindProgram(frameCtx) {
|
|
@@ -50754,7 +50966,7 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50754
50966
|
|
|
50755
50967
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
50756
50968
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
50757
|
-
|
|
50969
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
50758
50970
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
50759
50971
|
}
|
|
50760
50972
|
if (clipping) {
|
|
@@ -50809,11 +51021,14 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50809
51021
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
50810
51022
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
50811
51023
|
}
|
|
51024
|
+
src.push("uniform float sliceThickness;");
|
|
51025
|
+
src.push("uniform vec4 sliceColor;");
|
|
50812
51026
|
}
|
|
50813
51027
|
src.push("in vec4 vColor;");
|
|
50814
51028
|
src.push("out vec4 outColor;");
|
|
50815
51029
|
src.push("void main(void) {");
|
|
50816
|
-
|
|
51030
|
+
src.push(" vec4 newColor;");
|
|
51031
|
+
src.push(" newColor = vColor;");
|
|
50817
51032
|
if (clipping) {
|
|
50818
51033
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
50819
51034
|
src.push(" if (clippable) {");
|
|
@@ -50823,9 +51038,12 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50823
51038
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
50824
51039
|
src.push("}");
|
|
50825
51040
|
}
|
|
50826
|
-
|
|
50827
|
-
|
|
50828
|
-
|
|
51041
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
51042
|
+
src.push(" discard;");
|
|
51043
|
+
src.push(" }");
|
|
51044
|
+
src.push(" if (dist > 0.0) { ");
|
|
51045
|
+
src.push(" newColor = sliceColor;");
|
|
51046
|
+
src.push(" }");
|
|
50829
51047
|
src.push("}");
|
|
50830
51048
|
}
|
|
50831
51049
|
|
|
@@ -50842,9 +51060,9 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50842
51060
|
src.push(" float blendFactor = uSAOParams[3];");
|
|
50843
51061
|
src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
|
|
50844
51062
|
src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
|
|
50845
|
-
src.push(" outColor = vec4(
|
|
51063
|
+
src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");
|
|
50846
51064
|
} else {
|
|
50847
|
-
src.push(" outColor =
|
|
51065
|
+
src.push(" outColor = newColor;");
|
|
50848
51066
|
}
|
|
50849
51067
|
|
|
50850
51068
|
src.push("}");
|
|
@@ -50977,6 +51195,8 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50977
51195
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
50978
51196
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
50979
51197
|
}
|
|
51198
|
+
src.push("uniform float sliceThickness;");
|
|
51199
|
+
src.push("uniform vec4 sliceColor;");
|
|
50980
51200
|
}
|
|
50981
51201
|
|
|
50982
51202
|
this._addMatricesUniformBlockLines(src);
|
|
@@ -51005,7 +51225,8 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51005
51225
|
src.push("out vec4 outColor;");
|
|
51006
51226
|
|
|
51007
51227
|
src.push("void main(void) {");
|
|
51008
|
-
|
|
51228
|
+
src.push(" vec4 newColor;");
|
|
51229
|
+
src.push(" newColor = vColor;");
|
|
51009
51230
|
if (clipping) {
|
|
51010
51231
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
51011
51232
|
src.push(" if (clippable) {");
|
|
@@ -51015,9 +51236,12 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51015
51236
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
51016
51237
|
src.push("}");
|
|
51017
51238
|
}
|
|
51018
|
-
src.push(" if (dist >
|
|
51239
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
51019
51240
|
src.push(" discard;");
|
|
51020
51241
|
src.push(" }");
|
|
51242
|
+
src.push(" if (dist > 0.0) { ");
|
|
51243
|
+
src.push(" newColor = sliceColor;");
|
|
51244
|
+
src.push(" }");
|
|
51021
51245
|
src.push("}");
|
|
51022
51246
|
}
|
|
51023
51247
|
|
|
@@ -51061,7 +51285,7 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51061
51285
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
51062
51286
|
}
|
|
51063
51287
|
|
|
51064
|
-
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
51288
|
+
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
51065
51289
|
|
|
51066
51290
|
if (this._withSAO) {
|
|
51067
51291
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -51104,7 +51328,7 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51104
51328
|
const src = [];
|
|
51105
51329
|
src.push("#version 300 es");
|
|
51106
51330
|
src.push("// Triangles batching silhouette vertex shader");
|
|
51107
|
-
|
|
51331
|
+
|
|
51108
51332
|
src.push("uniform int renderPass;");
|
|
51109
51333
|
|
|
51110
51334
|
src.push("in vec3 position;");
|
|
@@ -51156,7 +51380,7 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51156
51380
|
src.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));");
|
|
51157
51381
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
51158
51382
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51159
|
-
|
|
51383
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
51160
51384
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
51161
51385
|
}
|
|
51162
51386
|
src.push("gl_Position = clipPos;");
|
|
@@ -51174,7 +51398,7 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51174
51398
|
const src = [];
|
|
51175
51399
|
src.push("#version 300 es");
|
|
51176
51400
|
src.push("// Triangles batching silhouette fragment shader");
|
|
51177
|
-
|
|
51401
|
+
|
|
51178
51402
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
51179
51403
|
src.push("precision highp float;");
|
|
51180
51404
|
src.push("precision highp int;");
|
|
@@ -51195,26 +51419,35 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51195
51419
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
51196
51420
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
51197
51421
|
}
|
|
51422
|
+
src.push("uniform float sliceThickness;");
|
|
51423
|
+
src.push("uniform vec4 sliceColor;");
|
|
51198
51424
|
}
|
|
51199
51425
|
src.push("in vec4 vColor;");
|
|
51200
51426
|
src.push("out vec4 outColor;");
|
|
51201
51427
|
src.push("void main(void) {");
|
|
51428
|
+
src.push(" vec4 newColor;");
|
|
51429
|
+
src.push(" newColor = vColor;");
|
|
51202
51430
|
if (clipping) {
|
|
51203
51431
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
51204
51432
|
src.push(" if (clippable) {");
|
|
51205
51433
|
src.push(" float dist = 0.0;");
|
|
51206
|
-
for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
|
|
51434
|
+
for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
|
|
51207
51435
|
src.push("if (sectionPlaneActive" + i + ") {");
|
|
51208
51436
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
51209
51437
|
src.push("}");
|
|
51210
51438
|
}
|
|
51211
|
-
src.push(" if (dist >
|
|
51439
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
51440
|
+
src.push(" discard;");
|
|
51441
|
+
src.push(" }");
|
|
51442
|
+
src.push(" if (dist > 0.0) { ");
|
|
51443
|
+
src.push(" newColor = sliceColor;");
|
|
51444
|
+
src.push(" }");
|
|
51212
51445
|
src.push("}");
|
|
51213
51446
|
}
|
|
51214
51447
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51215
51448
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
51216
51449
|
}
|
|
51217
|
-
src.push("outColor =
|
|
51450
|
+
src.push("outColor = newColor;");
|
|
51218
51451
|
src.push("}");
|
|
51219
51452
|
return src;
|
|
51220
51453
|
}
|
|
@@ -51300,7 +51533,7 @@ class EdgesEmphasisRenderer$1 extends EdgesRenderer$1 {
|
|
|
51300
51533
|
|
|
51301
51534
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
51302
51535
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51303
|
-
|
|
51536
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
51304
51537
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
51305
51538
|
}
|
|
51306
51539
|
src.push("gl_Position = clipPos;");
|
|
@@ -51317,7 +51550,7 @@ class EdgesEmphasisRenderer$1 extends EdgesRenderer$1 {
|
|
|
51317
51550
|
const src = [];
|
|
51318
51551
|
src.push("#version 300 es");
|
|
51319
51552
|
src.push("// EdgesEmphasisRenderer fragment shader");
|
|
51320
|
-
|
|
51553
|
+
|
|
51321
51554
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
51322
51555
|
src.push("precision highp float;");
|
|
51323
51556
|
src.push("precision highp int;");
|
|
@@ -51430,7 +51663,7 @@ class EdgesColorRenderer$1 extends EdgesRenderer$1 {
|
|
|
51430
51663
|
|
|
51431
51664
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
51432
51665
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51433
|
-
|
|
51666
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
51434
51667
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
51435
51668
|
}
|
|
51436
51669
|
src.push("gl_Position = clipPos;");
|
|
@@ -53183,6 +53416,8 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53183
53416
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
53184
53417
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
53185
53418
|
}
|
|
53419
|
+
src.push("uniform float sliceThickness;");
|
|
53420
|
+
src.push("uniform vec4 sliceColor;");
|
|
53186
53421
|
}
|
|
53187
53422
|
this._addMatricesUniformBlockLines(src);
|
|
53188
53423
|
src.push("uniform vec4 lightAmbient;");
|
|
@@ -53210,7 +53445,8 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53210
53445
|
src.push("out vec4 outColor;");
|
|
53211
53446
|
|
|
53212
53447
|
src.push("void main(void) {");
|
|
53213
|
-
|
|
53448
|
+
src.push(" vec4 newColor;");
|
|
53449
|
+
src.push(" newColor = vColor;");
|
|
53214
53450
|
if (clipping) {
|
|
53215
53451
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
53216
53452
|
src.push(" if (clippable) {");
|
|
@@ -53220,9 +53456,12 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53220
53456
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
53221
53457
|
src.push("}");
|
|
53222
53458
|
}
|
|
53223
|
-
src.push(" if (dist >
|
|
53459
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
53224
53460
|
src.push(" discard;");
|
|
53225
53461
|
src.push(" }");
|
|
53462
|
+
src.push(" if (dist > 0.0) { ");
|
|
53463
|
+
src.push(" newColor = sliceColor;");
|
|
53464
|
+
src.push(" }");
|
|
53226
53465
|
src.push("}");
|
|
53227
53466
|
}
|
|
53228
53467
|
|
|
@@ -53266,7 +53505,7 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53266
53505
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
53267
53506
|
}
|
|
53268
53507
|
|
|
53269
|
-
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
53508
|
+
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
53270
53509
|
if (gammaOutput) {
|
|
53271
53510
|
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
53272
53511
|
} else {
|
|
@@ -56047,11 +56286,14 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56047
56286
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
56048
56287
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
56049
56288
|
}
|
|
56289
|
+
src.push("uniform float sliceThickness;");
|
|
56290
|
+
src.push("uniform vec4 sliceColor;");
|
|
56050
56291
|
}
|
|
56051
56292
|
src.push("in vec4 vColor;");
|
|
56052
56293
|
src.push("out vec4 outColor;");
|
|
56053
56294
|
src.push("void main(void) {");
|
|
56054
|
-
|
|
56295
|
+
src.push(" vec4 newColor;");
|
|
56296
|
+
src.push(" newColor = vColor;");
|
|
56055
56297
|
if (clipping) {
|
|
56056
56298
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
56057
56299
|
src.push(" if (clippable) {");
|
|
@@ -56061,9 +56303,12 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56061
56303
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
56062
56304
|
src.push("}");
|
|
56063
56305
|
}
|
|
56064
|
-
src.push(" if (dist >
|
|
56306
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
56065
56307
|
src.push(" discard;");
|
|
56066
56308
|
src.push(" }");
|
|
56309
|
+
src.push(" if (dist > 0.0) { ");
|
|
56310
|
+
src.push(" newColor = sliceColor;");
|
|
56311
|
+
src.push(" }");
|
|
56067
56312
|
src.push("}");
|
|
56068
56313
|
}
|
|
56069
56314
|
|
|
@@ -56081,9 +56326,9 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56081
56326
|
src.push(" float blendFactor = uSAOParams[3];");
|
|
56082
56327
|
src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
|
|
56083
56328
|
src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
|
|
56084
|
-
src.push(" outColor = vec4(
|
|
56329
|
+
src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");
|
|
56085
56330
|
} else {
|
|
56086
|
-
src.push(" outColor =
|
|
56331
|
+
src.push(" outColor = newColor;");
|
|
56087
56332
|
}
|
|
56088
56333
|
src.push("}");
|
|
56089
56334
|
return src;
|
|
@@ -56108,7 +56353,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56108
56353
|
const src = [];
|
|
56109
56354
|
src.push("#version 300 es");
|
|
56110
56355
|
src.push("// Instancing geometry flat-shading drawing vertex shader");
|
|
56111
|
-
|
|
56356
|
+
|
|
56112
56357
|
src.push("uniform int renderPass;");
|
|
56113
56358
|
|
|
56114
56359
|
src.push("in vec3 position;");
|
|
@@ -56133,7 +56378,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56133
56378
|
src.push("}");
|
|
56134
56379
|
src.push("out float isPerspective;");
|
|
56135
56380
|
}
|
|
56136
|
-
|
|
56381
|
+
|
|
56137
56382
|
if (clipping) {
|
|
56138
56383
|
src.push("out vec4 vWorldPosition;");
|
|
56139
56384
|
src.push("out float vFlags;");
|
|
@@ -56165,7 +56410,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56165
56410
|
|
|
56166
56411
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
56167
56412
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56168
|
-
|
|
56413
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
56169
56414
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
56170
56415
|
}
|
|
56171
56416
|
|
|
@@ -56190,7 +56435,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56190
56435
|
const src = [];
|
|
56191
56436
|
src.push("#version 300 es");
|
|
56192
56437
|
src.push("// Instancing geometry flat-shading drawing fragment shader");
|
|
56193
|
-
|
|
56438
|
+
|
|
56194
56439
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
56195
56440
|
src.push("precision highp float;");
|
|
56196
56441
|
src.push("precision highp int;");
|
|
@@ -56199,9 +56444,9 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56199
56444
|
src.push("precision mediump int;");
|
|
56200
56445
|
src.push("#endif");
|
|
56201
56446
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56202
|
-
|
|
56203
|
-
|
|
56204
|
-
|
|
56447
|
+
src.push("in float isPerspective;");
|
|
56448
|
+
src.push("uniform float logDepthBufFC;");
|
|
56449
|
+
src.push("in float vFragDepth;");
|
|
56205
56450
|
}
|
|
56206
56451
|
if (this._withSAO) {
|
|
56207
56452
|
src.push("uniform sampler2D uOcclusionTexture;");
|
|
@@ -56224,6 +56469,8 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56224
56469
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
56225
56470
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
56226
56471
|
}
|
|
56472
|
+
src.push("uniform float sliceThickness;");
|
|
56473
|
+
src.push("uniform vec4 sliceColor;");
|
|
56227
56474
|
}
|
|
56228
56475
|
|
|
56229
56476
|
this._addMatricesUniformBlockLines(src);
|
|
@@ -56253,7 +56500,8 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56253
56500
|
src.push("out vec4 outColor;");
|
|
56254
56501
|
|
|
56255
56502
|
src.push("void main(void) {");
|
|
56256
|
-
|
|
56503
|
+
src.push(" vec4 newColor;");
|
|
56504
|
+
src.push(" newColor = vColor;");
|
|
56257
56505
|
if (clipping) {
|
|
56258
56506
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
56259
56507
|
src.push(" if (clippable) {");
|
|
@@ -56263,9 +56511,12 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56263
56511
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
56264
56512
|
src.push("}");
|
|
56265
56513
|
}
|
|
56266
|
-
src.push(" if (dist >
|
|
56514
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
56267
56515
|
src.push(" discard;");
|
|
56268
56516
|
src.push(" }");
|
|
56517
|
+
src.push(" if (dist > 0.0) { ");
|
|
56518
|
+
src.push(" newColor = sliceColor;");
|
|
56519
|
+
src.push(" }");
|
|
56269
56520
|
src.push("}");
|
|
56270
56521
|
}
|
|
56271
56522
|
|
|
@@ -56308,7 +56559,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56308
56559
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
56309
56560
|
}
|
|
56310
56561
|
|
|
56311
|
-
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
56562
|
+
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
56312
56563
|
|
|
56313
56564
|
if (this._withSAO) {
|
|
56314
56565
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -56350,7 +56601,7 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56350
56601
|
const src = [];
|
|
56351
56602
|
src.push("#version 300 es");
|
|
56352
56603
|
src.push("// Instancing silhouette vertex shader");
|
|
56353
|
-
|
|
56604
|
+
|
|
56354
56605
|
src.push("uniform int renderPass;");
|
|
56355
56606
|
|
|
56356
56607
|
src.push("in vec3 position;");
|
|
@@ -56409,7 +56660,7 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56409
56660
|
src.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));");
|
|
56410
56661
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
56411
56662
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56412
|
-
|
|
56663
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
56413
56664
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
56414
56665
|
}
|
|
56415
56666
|
src.push("gl_Position = clipPos;");
|
|
@@ -56425,7 +56676,7 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56425
56676
|
const src = [];
|
|
56426
56677
|
src.push("#version 300 es");
|
|
56427
56678
|
src.push("// Instancing fill fragment shader");
|
|
56428
|
-
|
|
56679
|
+
|
|
56429
56680
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
56430
56681
|
src.push("precision highp float;");
|
|
56431
56682
|
src.push("precision highp int;");
|
|
@@ -56446,10 +56697,14 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56446
56697
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
56447
56698
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
56448
56699
|
}
|
|
56700
|
+
src.push("uniform float sliceThickness;");
|
|
56701
|
+
src.push("uniform vec4 sliceColor;");
|
|
56449
56702
|
}
|
|
56450
56703
|
src.push("in vec4 vColor;");
|
|
56451
56704
|
src.push("out vec4 outColor;");
|
|
56452
56705
|
src.push("void main(void) {");
|
|
56706
|
+
src.push(" vec4 newColor;");
|
|
56707
|
+
src.push(" newColor = vColor;");
|
|
56453
56708
|
if (clipping) {
|
|
56454
56709
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
56455
56710
|
src.push(" if (clippable) {");
|
|
@@ -56459,13 +56714,18 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56459
56714
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
56460
56715
|
src.push("}");
|
|
56461
56716
|
}
|
|
56462
|
-
src.push("if (dist >
|
|
56717
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
56718
|
+
src.push(" discard;");
|
|
56719
|
+
src.push(" }");
|
|
56720
|
+
src.push(" if (dist > 0.0) { ");
|
|
56721
|
+
src.push(" newColor = sliceColor;");
|
|
56722
|
+
src.push(" }");
|
|
56463
56723
|
src.push("}");
|
|
56464
56724
|
}
|
|
56465
56725
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56466
56726
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
56467
56727
|
}
|
|
56468
|
-
src.push("outColor =
|
|
56728
|
+
src.push("outColor = newColor;");
|
|
56469
56729
|
src.push("}");
|
|
56470
56730
|
return src;
|
|
56471
56731
|
}
|
|
@@ -58495,6 +58755,8 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58495
58755
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
58496
58756
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
58497
58757
|
}
|
|
58758
|
+
src.push("uniform float sliceThickness;");
|
|
58759
|
+
src.push("uniform vec4 sliceColor;");
|
|
58498
58760
|
}
|
|
58499
58761
|
this._addMatricesUniformBlockLines(src);
|
|
58500
58762
|
|
|
@@ -58523,7 +58785,8 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58523
58785
|
src.push("out vec4 outColor;");
|
|
58524
58786
|
|
|
58525
58787
|
src.push("void main(void) {");
|
|
58526
|
-
|
|
58788
|
+
src.push(" vec4 newColor;");
|
|
58789
|
+
src.push(" newColor = vColor;");
|
|
58527
58790
|
if (clipping) {
|
|
58528
58791
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
58529
58792
|
src.push(" if (clippable) {");
|
|
@@ -58533,9 +58796,12 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58533
58796
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
58534
58797
|
src.push("}");
|
|
58535
58798
|
}
|
|
58536
|
-
src.push(" if (dist >
|
|
58799
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
58537
58800
|
src.push(" discard;");
|
|
58538
58801
|
src.push(" }");
|
|
58802
|
+
src.push(" if (dist > 0.0) { ");
|
|
58803
|
+
src.push(" newColor = sliceColor;");
|
|
58804
|
+
src.push(" }");
|
|
58539
58805
|
src.push("}");
|
|
58540
58806
|
}
|
|
58541
58807
|
|
|
@@ -58578,7 +58844,7 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58578
58844
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
58579
58845
|
}
|
|
58580
58846
|
|
|
58581
|
-
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
58847
|
+
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
58582
58848
|
if (gammaOutput) {
|
|
58583
58849
|
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
58584
58850
|
} else {
|
|
@@ -58595,9 +58861,9 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58595
58861
|
src.push(" float blendFactor = uSAOParams[3];");
|
|
58596
58862
|
src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
|
|
58597
58863
|
src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
|
|
58598
|
-
src.push(" outColor = vec4(
|
|
58864
|
+
src.push(" outColor = vec4(newColor.rgb * colorTexel.rgb * ambient, opacity);");
|
|
58599
58865
|
} else {
|
|
58600
|
-
src.push(" outColor = vec4(
|
|
58866
|
+
src.push(" outColor = vec4(newColor.rgb * colorTexel.rgb, opacity);");
|
|
58601
58867
|
}
|
|
58602
58868
|
|
|
58603
58869
|
if (gammaOutput) {
|
|
@@ -80419,7 +80685,7 @@ class SceneModelTransform {
|
|
|
80419
80685
|
this._childTransforms.push(childTransform);
|
|
80420
80686
|
childTransform._parentTransform = this;
|
|
80421
80687
|
childTransform._transformDirty();
|
|
80422
|
-
childTransform.
|
|
80688
|
+
childTransform._setSubtreeAABBsDirty(this);
|
|
80423
80689
|
}
|
|
80424
80690
|
|
|
80425
80691
|
_addMesh(mesh) {
|
|
@@ -87075,7 +87341,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87075
87341
|
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87076
87342
|
* and rebinds various input handlers.
|
|
87077
87343
|
*
|
|
87078
|
-
* @param
|
|
87344
|
+
* @param snapping
|
|
87079
87345
|
*/
|
|
87080
87346
|
set snapping(snapping) {
|
|
87081
87347
|
if (snapping !== this._snapping) {
|
|
@@ -87091,13 +87357,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87091
87357
|
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87092
87358
|
*
|
|
87093
87359
|
* This is `true` by default.
|
|
87094
|
-
*
|
|
87095
|
-
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87360
|
+
* @returns {*}
|
|
87096
87361
|
*/
|
|
87097
87362
|
get snapping() {
|
|
87098
87363
|
return this._snapping;
|
|
87099
87364
|
}
|
|
87100
|
-
|
|
87365
|
+
|
|
87101
87366
|
/**
|
|
87102
87367
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
87103
87368
|
*/
|
|
@@ -87132,12 +87397,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87132
87397
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
87133
87398
|
|
|
87134
87399
|
const pagePos = math.vec2();
|
|
87135
|
-
|
|
87400
|
+
|
|
87136
87401
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
87137
87402
|
this._snapping
|
|
87138
87403
|
? "hoverSnapOrSurface"
|
|
87139
87404
|
: "hoverSurface", event => {
|
|
87140
|
-
|
|
87405
|
+
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87141
87406
|
mouseHovering = true;
|
|
87142
87407
|
pointerWorldPos.set(event.worldPos);
|
|
87143
87408
|
pointerCanvasPos.set(event.canvasPos);
|
|
@@ -87165,7 +87430,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87165
87430
|
} else {
|
|
87166
87431
|
if (this.pointerLens) {
|
|
87167
87432
|
this.pointerLens.visible = true;
|
|
87168
|
-
this.pointerLens.canvasPos =
|
|
87433
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87169
87434
|
this.pointerLens.snappedCanvasPos = event.canvasPos;
|
|
87170
87435
|
this.pointerLens.snapped = false;
|
|
87171
87436
|
}
|
|
@@ -87199,7 +87464,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87199
87464
|
pointerDownCanvasY = e.clientY;
|
|
87200
87465
|
});
|
|
87201
87466
|
|
|
87202
|
-
canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
|
|
87467
|
+
canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
|
|
87203
87468
|
if (e.which !== 1) {
|
|
87204
87469
|
return;
|
|
87205
87470
|
}
|
|
@@ -87254,21 +87519,21 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87254
87519
|
this._snapping
|
|
87255
87520
|
? "hoverSnapOrSurfaceOff"
|
|
87256
87521
|
: "hoverOff", event => {
|
|
87257
|
-
|
|
87258
|
-
|
|
87259
|
-
|
|
87260
|
-
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87522
|
+
if (this.pointerLens) {
|
|
87523
|
+
this.pointerLens.visible = true;
|
|
87524
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87525
|
+
this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87526
|
+
}
|
|
87527
|
+
mouseHovering = false;
|
|
87528
|
+
this._markerDiv.style.left = `-100px`;
|
|
87529
|
+
this._markerDiv.style.top = `-100px`;
|
|
87530
|
+
if (this._currentDistanceMeasurement) {
|
|
87531
|
+
this._currentDistanceMeasurement.wireVisible = false;
|
|
87532
|
+
this._currentDistanceMeasurement.targetVisible = false;
|
|
87533
|
+
this._currentDistanceMeasurement.axisVisible = false;
|
|
87534
|
+
}
|
|
87535
|
+
canvas.style.cursor = "default";
|
|
87536
|
+
});
|
|
87272
87537
|
|
|
87273
87538
|
this._active = true;
|
|
87274
87539
|
}
|
|
@@ -87943,8 +88208,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87943
88208
|
this._onCanvasTouchStart = null;
|
|
87944
88209
|
this._onCanvasTouchEnd = null;
|
|
87945
88210
|
this._longTouchTimeoutMs = 300;
|
|
87946
|
-
this.
|
|
87947
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
88211
|
+
this._snapping = cfg.snapping !== false;
|
|
87948
88212
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
87949
88213
|
|
|
87950
88214
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
@@ -87974,39 +88238,35 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87974
88238
|
}
|
|
87975
88239
|
|
|
87976
88240
|
/**
|
|
87977
|
-
* Sets whether snap-to-vertex
|
|
87978
|
-
*
|
|
87979
|
-
* @param snapToVertex
|
|
87980
|
-
*/
|
|
87981
|
-
set snapToVertex(snapToVertex) {
|
|
87982
|
-
this._snapToVertex = snapToVertex;
|
|
87983
|
-
}
|
|
87984
|
-
|
|
87985
|
-
/**
|
|
87986
|
-
* Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
|
|
87987
|
-
* This is `true` by default.
|
|
87988
|
-
* @returns {*}
|
|
87989
|
-
*/
|
|
87990
|
-
get snapToVertex() {
|
|
87991
|
-
return this._snapToVertex;
|
|
87992
|
-
}
|
|
87993
|
-
|
|
87994
|
-
/**
|
|
87995
|
-
* Sets whether snap-to-edge is enabled for this DistanceMeasurementsTouchControl.
|
|
88241
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88242
|
+
*
|
|
87996
88243
|
* This is `true` by default.
|
|
87997
|
-
*
|
|
88244
|
+
*
|
|
88245
|
+
* Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that
|
|
88246
|
+
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
88247
|
+
* and rebinds various input handlers.
|
|
88248
|
+
*
|
|
88249
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.
|
|
87998
88250
|
*/
|
|
87999
|
-
set
|
|
88000
|
-
this.
|
|
88251
|
+
set snapping(snapping) {
|
|
88252
|
+
if (snapping !== this._snapping) {
|
|
88253
|
+
this._snapping = snapping;
|
|
88254
|
+
this.deactivate();
|
|
88255
|
+
this.activate();
|
|
88256
|
+
} else {
|
|
88257
|
+
this._snapping = snapping;
|
|
88258
|
+
}
|
|
88001
88259
|
}
|
|
88002
88260
|
|
|
88003
88261
|
/**
|
|
88004
|
-
* Gets whether snap-to-edge
|
|
88262
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88263
|
+
*
|
|
88005
88264
|
* This is `true` by default.
|
|
88006
|
-
*
|
|
88265
|
+
*
|
|
88266
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88007
88267
|
*/
|
|
88008
|
-
get
|
|
88009
|
-
return this.
|
|
88268
|
+
get snapping() {
|
|
88269
|
+
return this._snapping;
|
|
88010
88270
|
}
|
|
88011
88271
|
|
|
88012
88272
|
/**
|
|
@@ -88036,11 +88296,11 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88036
88296
|
|
|
88037
88297
|
let touchId = null;
|
|
88038
88298
|
|
|
88039
|
-
const
|
|
88299
|
+
const disableCameraNavigation = () => {
|
|
88040
88300
|
this.plugin.viewer.cameraControl.active = false;
|
|
88041
88301
|
};
|
|
88042
88302
|
|
|
88043
|
-
const
|
|
88303
|
+
const enableCameraNavigation = () => {
|
|
88044
88304
|
this.plugin.viewer.cameraControl.active = true;
|
|
88045
88305
|
};
|
|
88046
88306
|
|
|
@@ -88053,7 +88313,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88053
88313
|
this._currentDistanceMeasurement.destroy();
|
|
88054
88314
|
this._currentDistanceMeasurement = null;
|
|
88055
88315
|
}
|
|
88056
|
-
|
|
88316
|
+
enableCameraNavigation();
|
|
88057
88317
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88058
88318
|
};
|
|
88059
88319
|
|
|
@@ -88085,8 +88345,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88085
88345
|
}
|
|
88086
88346
|
const snapPickResult = scene.pick({
|
|
88087
88347
|
canvasPos: touchMoveCanvasPos,
|
|
88088
|
-
|
|
88089
|
-
snapToEdge: this.
|
|
88348
|
+
snapping: this._snapping,
|
|
88349
|
+
snapToEdge: this._snapping
|
|
88090
88350
|
});
|
|
88091
88351
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88092
88352
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -88156,7 +88416,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88156
88416
|
// }
|
|
88157
88417
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
|
|
88158
88418
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
88159
|
-
|
|
88419
|
+
disableCameraNavigation();
|
|
88160
88420
|
}, this._longTouchTimeoutMs);
|
|
88161
88421
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
|
|
88162
88422
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -88194,8 +88454,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88194
88454
|
|
|
88195
88455
|
const snapPickResult = scene.pick({
|
|
88196
88456
|
canvasPos: touchMoveCanvasPos,
|
|
88197
|
-
snapToVertex: this.
|
|
88198
|
-
snapToEdge: this.
|
|
88457
|
+
snapToVertex: this._snapping,
|
|
88458
|
+
snapToEdge: this._snapping
|
|
88199
88459
|
});
|
|
88200
88460
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88201
88461
|
if (this.pointerLens) {
|
|
@@ -88239,7 +88499,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88239
88499
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
|
|
88240
88500
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
88241
88501
|
|
|
88242
|
-
|
|
88502
|
+
disableCameraNavigation();
|
|
88243
88503
|
|
|
88244
88504
|
}, this._longTouchTimeoutMs);
|
|
88245
88505
|
|
|
@@ -88299,10 +88559,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88299
88559
|
}
|
|
88300
88560
|
snapPickResult = scene.pick({
|
|
88301
88561
|
canvasPos: touchMoveCanvasPos,
|
|
88302
|
-
|
|
88303
|
-
|
|
88304
|
-
snapToVertex: this._snapToVertex,
|
|
88305
|
-
snapToEdge: this._snapToEdge
|
|
88562
|
+
snapToVertex: this._snapping,
|
|
88563
|
+
snapToEdge: this._snapping
|
|
88306
88564
|
});
|
|
88307
88565
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
88308
88566
|
if (this.pointerLens) {
|
|
@@ -88403,8 +88661,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88403
88661
|
}
|
|
88404
88662
|
snapPickResult = scene.pick({
|
|
88405
88663
|
canvasPos: touchMoveCanvasPos,
|
|
88406
|
-
snapToVertex: this.
|
|
88407
|
-
snapToEdge: this.
|
|
88664
|
+
snapToVertex: this._snapping,
|
|
88665
|
+
snapToEdge: this._snapping
|
|
88408
88666
|
});
|
|
88409
88667
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
88410
88668
|
if (this.pointerLens) {
|
|
@@ -88510,7 +88768,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88510
88768
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88511
88769
|
}
|
|
88512
88770
|
}
|
|
88513
|
-
|
|
88771
|
+
enableCameraNavigation();
|
|
88514
88772
|
break;
|
|
88515
88773
|
|
|
88516
88774
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
|
|
@@ -88528,7 +88786,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88528
88786
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88529
88787
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
88530
88788
|
}
|
|
88531
|
-
|
|
88789
|
+
enableCameraNavigation();
|
|
88532
88790
|
break;
|
|
88533
88791
|
|
|
88534
88792
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
|
|
@@ -88561,7 +88819,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88561
88819
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88562
88820
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88563
88821
|
}
|
|
88564
|
-
|
|
88822
|
+
enableCameraNavigation();
|
|
88565
88823
|
break;
|
|
88566
88824
|
|
|
88567
88825
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:
|
|
@@ -88582,7 +88840,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88582
88840
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88583
88841
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88584
88842
|
}
|
|
88585
|
-
|
|
88843
|
+
enableCameraNavigation();
|
|
88586
88844
|
break;
|
|
88587
88845
|
}
|
|
88588
88846
|
|