@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.cjs.js
CHANGED
|
@@ -13086,8 +13086,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13086
13086
|
this._onCanvasTouchStart = null;
|
|
13087
13087
|
this._onCanvasTouchEnd = null;
|
|
13088
13088
|
this._longTouchTimeoutMs = 300;
|
|
13089
|
-
this.
|
|
13090
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
13089
|
+
this._snapping = cfg.snapping !== false;
|
|
13091
13090
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13092
13091
|
|
|
13093
13092
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
@@ -13117,39 +13116,35 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13117
13116
|
}
|
|
13118
13117
|
|
|
13119
13118
|
/**
|
|
13120
|
-
* Sets whether snap-to-vertex
|
|
13121
|
-
*
|
|
13122
|
-
* @param snapToVertex
|
|
13123
|
-
*/
|
|
13124
|
-
set snapToVertex(snapToVertex) {
|
|
13125
|
-
this._snapToVertex = snapToVertex;
|
|
13126
|
-
}
|
|
13127
|
-
|
|
13128
|
-
/**
|
|
13129
|
-
* Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
|
|
13130
|
-
* This is `true` by default.
|
|
13131
|
-
* @returns {*}
|
|
13132
|
-
*/
|
|
13133
|
-
get snapToVertex() {
|
|
13134
|
-
return this._snapToVertex;
|
|
13135
|
-
}
|
|
13136
|
-
|
|
13137
|
-
/**
|
|
13138
|
-
* Sets whether snap-to-edge is enabled for this AngleMeasurementsTouchControl.
|
|
13119
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13120
|
+
*
|
|
13139
13121
|
* This is `true` by default.
|
|
13140
|
-
*
|
|
13122
|
+
*
|
|
13123
|
+
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
13124
|
+
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
13125
|
+
* and rebinds various input handlers.
|
|
13126
|
+
*
|
|
13127
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
13141
13128
|
*/
|
|
13142
|
-
set
|
|
13143
|
-
this.
|
|
13129
|
+
set snapping(snapping) {
|
|
13130
|
+
if (snapping !== this._snapping) {
|
|
13131
|
+
this._snapping = snapping;
|
|
13132
|
+
this.deactivate();
|
|
13133
|
+
this.activate();
|
|
13134
|
+
} else {
|
|
13135
|
+
this._snapping = snapping;
|
|
13136
|
+
}
|
|
13144
13137
|
}
|
|
13145
13138
|
|
|
13146
13139
|
/**
|
|
13147
|
-
* Gets whether snap-to-edge
|
|
13140
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13141
|
+
*
|
|
13148
13142
|
* This is `true` by default.
|
|
13149
|
-
*
|
|
13143
|
+
*
|
|
13144
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13150
13145
|
*/
|
|
13151
|
-
get
|
|
13152
|
-
return this.
|
|
13146
|
+
get snapping() {
|
|
13147
|
+
return this._snapping;
|
|
13153
13148
|
}
|
|
13154
13149
|
|
|
13155
13150
|
/**
|
|
@@ -13179,11 +13174,11 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13179
13174
|
|
|
13180
13175
|
let touchId = null;
|
|
13181
13176
|
|
|
13182
|
-
const
|
|
13177
|
+
const disableCameraNavigation = () => {
|
|
13183
13178
|
this.plugin.viewer.cameraControl.active = false;
|
|
13184
13179
|
};
|
|
13185
13180
|
|
|
13186
|
-
const
|
|
13181
|
+
const enableCameraNavigation = () => {
|
|
13187
13182
|
this.plugin.viewer.cameraControl.active = true;
|
|
13188
13183
|
};
|
|
13189
13184
|
|
|
@@ -13196,7 +13191,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13196
13191
|
this._currentAngleMeasurement.destroy();
|
|
13197
13192
|
this._currentAngleMeasurement = null;
|
|
13198
13193
|
}
|
|
13199
|
-
|
|
13194
|
+
enableCameraNavigation();
|
|
13200
13195
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13201
13196
|
};
|
|
13202
13197
|
|
|
@@ -13228,8 +13223,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13228
13223
|
}
|
|
13229
13224
|
const snapPickResult = scene.pick({
|
|
13230
13225
|
canvasPos: touchMoveCanvasPos,
|
|
13231
|
-
snapToVertex: this.
|
|
13232
|
-
snapToEdge: this.
|
|
13226
|
+
snapToVertex: this._snapping,
|
|
13227
|
+
snapToEdge: this._snapping
|
|
13233
13228
|
});
|
|
13234
13229
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13235
13230
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -13303,7 +13298,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13303
13298
|
// }
|
|
13304
13299
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;
|
|
13305
13300
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
13306
|
-
|
|
13301
|
+
disableCameraNavigation();
|
|
13307
13302
|
}, this._longTouchTimeoutMs);
|
|
13308
13303
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1;
|
|
13309
13304
|
//console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -13340,8 +13335,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13340
13335
|
|
|
13341
13336
|
const snapPickResult = scene.pick({
|
|
13342
13337
|
canvasPos: touchMoveCanvasPos,
|
|
13343
|
-
snapToVertex: this.
|
|
13344
|
-
snapToEdge: this.
|
|
13338
|
+
snapToVertex: this._snapping,
|
|
13339
|
+
snapToEdge: this._snapping
|
|
13345
13340
|
});
|
|
13346
13341
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13347
13342
|
if (this.pointerLens) {
|
|
@@ -13393,7 +13388,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13393
13388
|
this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
|
|
13394
13389
|
// console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
|
|
13395
13390
|
|
|
13396
|
-
|
|
13391
|
+
disableCameraNavigation();
|
|
13397
13392
|
|
|
13398
13393
|
}, this._longTouchTimeoutMs);
|
|
13399
13394
|
|
|
@@ -13433,8 +13428,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13433
13428
|
|
|
13434
13429
|
const snapPickResult = scene.pick({
|
|
13435
13430
|
canvasPos: touchMoveCanvasPos,
|
|
13436
|
-
snapToVertex: this.
|
|
13437
|
-
snapToEdge: this.
|
|
13431
|
+
snapToVertex: this._snapping,
|
|
13432
|
+
snapToEdge: this._snapping
|
|
13438
13433
|
});
|
|
13439
13434
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13440
13435
|
if (this.pointerLens) {
|
|
@@ -13486,7 +13481,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13486
13481
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END$1;
|
|
13487
13482
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
13488
13483
|
|
|
13489
|
-
|
|
13484
|
+
disableCameraNavigation();
|
|
13490
13485
|
|
|
13491
13486
|
}, this._longTouchTimeoutMs);
|
|
13492
13487
|
|
|
@@ -13547,8 +13542,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13547
13542
|
}
|
|
13548
13543
|
snapPickResult = scene.pick({
|
|
13549
13544
|
canvasPos: touchMoveCanvasPos,
|
|
13550
|
-
snapToVertex: this.
|
|
13551
|
-
snapToEdge: this.
|
|
13545
|
+
snapToVertex: this._snapping,
|
|
13546
|
+
snapToEdge: this._snapping
|
|
13552
13547
|
});
|
|
13553
13548
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
13554
13549
|
if (this.pointerLens) {
|
|
@@ -13596,8 +13591,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13596
13591
|
}
|
|
13597
13592
|
snapPickResult = scene.pick({
|
|
13598
13593
|
canvasPos: touchMoveCanvasPos,
|
|
13599
|
-
snapToVertex: this.
|
|
13600
|
-
snapToEdge: this.
|
|
13594
|
+
snapToVertex: this._snapping,
|
|
13595
|
+
snapToEdge: this._snapping
|
|
13601
13596
|
});
|
|
13602
13597
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13603
13598
|
if (this.pointerLens) {
|
|
@@ -13652,8 +13647,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13652
13647
|
}
|
|
13653
13648
|
snapPickResult = scene.pick({
|
|
13654
13649
|
canvasPos: touchMoveCanvasPos,
|
|
13655
|
-
snapToVertex: this.
|
|
13656
|
-
snapToEdge: this.
|
|
13650
|
+
snapToVertex: this._snapping,
|
|
13651
|
+
snapToEdge: this._snapping
|
|
13657
13652
|
});
|
|
13658
13653
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13659
13654
|
if (this.pointerLens) {
|
|
@@ -13765,7 +13760,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13765
13760
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13766
13761
|
}
|
|
13767
13762
|
}
|
|
13768
|
-
|
|
13763
|
+
enableCameraNavigation();
|
|
13769
13764
|
break;
|
|
13770
13765
|
|
|
13771
13766
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
@@ -13783,7 +13778,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13783
13778
|
this._touchState = WAITING_FOR_CORNER_TOUCH_START;
|
|
13784
13779
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
|
|
13785
13780
|
}
|
|
13786
|
-
|
|
13781
|
+
enableCameraNavigation();
|
|
13787
13782
|
break;
|
|
13788
13783
|
|
|
13789
13784
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
|
|
@@ -13820,7 +13815,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13820
13815
|
}
|
|
13821
13816
|
|
|
13822
13817
|
}
|
|
13823
|
-
|
|
13818
|
+
enableCameraNavigation();
|
|
13824
13819
|
break;
|
|
13825
13820
|
|
|
13826
13821
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
@@ -13829,7 +13824,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13829
13824
|
}
|
|
13830
13825
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START$1;
|
|
13831
13826
|
// console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13832
|
-
|
|
13827
|
+
enableCameraNavigation();
|
|
13833
13828
|
break;
|
|
13834
13829
|
|
|
13835
13830
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1: {
|
|
@@ -13865,7 +13860,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13865
13860
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13866
13861
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13867
13862
|
}
|
|
13868
|
-
|
|
13863
|
+
enableCameraNavigation();
|
|
13869
13864
|
break;
|
|
13870
13865
|
|
|
13871
13866
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
@@ -13886,7 +13881,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13886
13881
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13887
13882
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13888
13883
|
}
|
|
13889
|
-
|
|
13884
|
+
enableCameraNavigation();
|
|
13890
13885
|
break;
|
|
13891
13886
|
}
|
|
13892
13887
|
|
|
@@ -28410,6 +28405,206 @@ class SAO extends Component {
|
|
|
28410
28405
|
}
|
|
28411
28406
|
}
|
|
28412
28407
|
|
|
28408
|
+
/**
|
|
28409
|
+
* @desc Configures cross-section slices for a {@link Scene}.
|
|
28410
|
+
*
|
|
28411
|
+
* ## Overview
|
|
28412
|
+
*
|
|
28413
|
+
* Cross-sections allow to create an additional colored slice for used clipping planes. It is only a visual effect
|
|
28414
|
+
* calculated by shaders. It makes it easier to see the intersection between the model and the clipping plane this way.
|
|
28415
|
+
*
|
|
28416
|
+
* ## Usage
|
|
28417
|
+
*
|
|
28418
|
+
* In the example below, we'll configure CrossSections to manipulate the slice representation.
|
|
28419
|
+
*
|
|
28420
|
+
* ````javascript
|
|
28421
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28422
|
+
* // Import the modules we need for this example
|
|
28423
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28424
|
+
*
|
|
28425
|
+
* import {PhongMaterial, Viewer, math, SectionPlanesPlugin, XKTLoaderPlugin, Mesh, ReadableGeometry, buildPolylineGeometryFromCurve, SplineCurve} from "../../dist/xeokit-sdk.es.js";
|
|
28426
|
+
*
|
|
28427
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28428
|
+
* // Create a Viewer and arrange the camera
|
|
28429
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28430
|
+
*
|
|
28431
|
+
* const viewer = new Viewer({
|
|
28432
|
+
* canvasId: "myCanvas",
|
|
28433
|
+
* transparent: true
|
|
28434
|
+
* });
|
|
28435
|
+
*
|
|
28436
|
+
* viewer.camera.eye = [-2.341298674548419, 22.43987089731119, 7.236688436028655];
|
|
28437
|
+
* viewer.camera.look = [4.399999999999963, 3.7240000000000606, 8.899000000000006];
|
|
28438
|
+
* viewer.camera.up = [0.9102954845584759, 0.34781746407929504, 0.22446635042673466];
|
|
28439
|
+
*
|
|
28440
|
+
* const cameraControl = viewer.cameraControl;
|
|
28441
|
+
* cameraControl.navMode = "orbit";
|
|
28442
|
+
* cameraControl.followPointer = true;
|
|
28443
|
+
*
|
|
28444
|
+
* //----------------------------------------------------------------------------------------------------------------------
|
|
28445
|
+
* // Create a xeokit loader plugin, load a model, fit to view
|
|
28446
|
+
* //----------------------------------------------------------------------------------------------------------------------
|
|
28447
|
+
*
|
|
28448
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
|
28449
|
+
*
|
|
28450
|
+
* var t0 = performance.now();
|
|
28451
|
+
*
|
|
28452
|
+
* document.getElementById("time").innerHTML = "Loading model...";
|
|
28453
|
+
*
|
|
28454
|
+
* const sceneModel = xktLoader.load({
|
|
28455
|
+
* id: "myModel",
|
|
28456
|
+
* src: "../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt",
|
|
28457
|
+
* edges: true
|
|
28458
|
+
* });
|
|
28459
|
+
*
|
|
28460
|
+
* sceneModel.on("loaded", () => {
|
|
28461
|
+
* var t1 = performance.now();
|
|
28462
|
+
* document.getElementById("time").innerHTML = "Model loaded in " + Math.floor(t1 - t0) / 1000.0 + " seconds<br>Objects: " + sceneModel.numEntities;
|
|
28463
|
+
*
|
|
28464
|
+
* let path = new SplineCurve(viewer.scene, {
|
|
28465
|
+
* points: [
|
|
28466
|
+
* [0, 0, -10],
|
|
28467
|
+
* [0, 0, -3],
|
|
28468
|
+
* [10, 0, 10],
|
|
28469
|
+
* [10, 0, 30],
|
|
28470
|
+
* ],
|
|
28471
|
+
* });
|
|
28472
|
+
*
|
|
28473
|
+
* new Mesh(viewer.scene, {
|
|
28474
|
+
* geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({
|
|
28475
|
+
* id: "SplineCurve",
|
|
28476
|
+
* curve: path,
|
|
28477
|
+
* divisions: 50,
|
|
28478
|
+
* })),
|
|
28479
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
28480
|
+
* emissive: [1, 0, 0]
|
|
28481
|
+
* })
|
|
28482
|
+
* });
|
|
28483
|
+
*
|
|
28484
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28485
|
+
* // Create a moving SectionPlane, that moves through the table models
|
|
28486
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28487
|
+
*
|
|
28488
|
+
* const sectionPlanes = new SectionPlanesPlugin(viewer, {
|
|
28489
|
+
* overviewCanvasId: "mySectionPlanesOverviewCanvas",
|
|
28490
|
+
* overviewVisible: true
|
|
28491
|
+
* });
|
|
28492
|
+
*
|
|
28493
|
+
* let currentPoint = path.getPoint(0);
|
|
28494
|
+
* let currentDirection = path.getTangent(0);
|
|
28495
|
+
*
|
|
28496
|
+
* const sectionPlane = sectionPlanes.createSectionPlane({
|
|
28497
|
+
* id: "mySectionPlane",
|
|
28498
|
+
* pos: currentPoint,
|
|
28499
|
+
* dir: currentDirection
|
|
28500
|
+
* });
|
|
28501
|
+
*
|
|
28502
|
+
* sectionPlanes.showControl(sectionPlane.id);
|
|
28503
|
+
*
|
|
28504
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28505
|
+
* // Controlling SectionPlane position and direction
|
|
28506
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28507
|
+
*
|
|
28508
|
+
* let currentT = 0.0;
|
|
28509
|
+
* document.getElementById("section_path").oninput = function() {
|
|
28510
|
+
* currentT = Number(document.getElementById("section_path").value);
|
|
28511
|
+
* currentPoint = path.getPoint(currentT);
|
|
28512
|
+
* currentDirection = path.getTangent(currentT);
|
|
28513
|
+
* sectionPlane.pos = currentPoint;
|
|
28514
|
+
* sectionPlane.dir = currentDirection;
|
|
28515
|
+
* };
|
|
28516
|
+
*
|
|
28517
|
+
* window.viewer = viewer;
|
|
28518
|
+
*
|
|
28519
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28520
|
+
* // Controlling CrossSections settings
|
|
28521
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
28522
|
+
*
|
|
28523
|
+
* viewer.scene.crossSections.sliceThickness = 0.05;
|
|
28524
|
+
* viewer.scene.crossSections.sliceColor = [0.0, 0.0, 0.0, 1.0];
|
|
28525
|
+
* });
|
|
28526
|
+
* ````
|
|
28527
|
+
*
|
|
28528
|
+
* [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/slicing/#SectionPlanesPlugin_Duplex_SectionPath_CrossSections)]
|
|
28529
|
+
*
|
|
28530
|
+
*/
|
|
28531
|
+
class CrossSections extends Component {
|
|
28532
|
+
|
|
28533
|
+
/** @private */
|
|
28534
|
+
constructor(owner, cfg = {}) {
|
|
28535
|
+
|
|
28536
|
+
super(owner, cfg);
|
|
28537
|
+
|
|
28538
|
+
this.sliceColor = cfg.sliceColor;
|
|
28539
|
+
this.sliceThickness = cfg.sliceThickness;
|
|
28540
|
+
}
|
|
28541
|
+
|
|
28542
|
+
/**
|
|
28543
|
+
* Sets the thickness of a slice created by a section.
|
|
28544
|
+
*
|
|
28545
|
+
* Default value is ````0.0````.
|
|
28546
|
+
*
|
|
28547
|
+
* @type {Number}
|
|
28548
|
+
*/
|
|
28549
|
+
set sliceThickness(value) {
|
|
28550
|
+
if (value === undefined || value === null) {
|
|
28551
|
+
value = 0.0;
|
|
28552
|
+
}
|
|
28553
|
+
if (this._sliceThickness === value) {
|
|
28554
|
+
return;
|
|
28555
|
+
}
|
|
28556
|
+
this._sliceThickness = value;
|
|
28557
|
+
this.glRedraw();
|
|
28558
|
+
}
|
|
28559
|
+
|
|
28560
|
+
/**
|
|
28561
|
+
* Gets the thickness of a slice created by a section.
|
|
28562
|
+
*
|
|
28563
|
+
* Default value is ````0.0````.
|
|
28564
|
+
*
|
|
28565
|
+
* @type {Number}
|
|
28566
|
+
*/
|
|
28567
|
+
get sliceThickness() {
|
|
28568
|
+
return this._sliceThickness;
|
|
28569
|
+
}
|
|
28570
|
+
|
|
28571
|
+
/**
|
|
28572
|
+
* Sets the color of a slice created by a section.
|
|
28573
|
+
*
|
|
28574
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
28575
|
+
*
|
|
28576
|
+
* @type {Number}
|
|
28577
|
+
*/
|
|
28578
|
+
set sliceColor(value) {
|
|
28579
|
+
if (value === undefined || value === null) {
|
|
28580
|
+
value = [0.0, 0.0, 0.0, 1.0];
|
|
28581
|
+
}
|
|
28582
|
+
if (this._sliceColor === value) {
|
|
28583
|
+
return;
|
|
28584
|
+
}
|
|
28585
|
+
this._sliceColor = value;
|
|
28586
|
+
this.glRedraw();
|
|
28587
|
+
}
|
|
28588
|
+
|
|
28589
|
+
/**
|
|
28590
|
+
* Gets the color of a slice created by a section.
|
|
28591
|
+
*
|
|
28592
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
28593
|
+
*
|
|
28594
|
+
* @type {Number}
|
|
28595
|
+
*/
|
|
28596
|
+
get sliceColor() {
|
|
28597
|
+
return this._sliceColor;
|
|
28598
|
+
}
|
|
28599
|
+
|
|
28600
|
+
/**
|
|
28601
|
+
* Destroys this component.
|
|
28602
|
+
*/
|
|
28603
|
+
destroy() {
|
|
28604
|
+
super.destroy();
|
|
28605
|
+
}
|
|
28606
|
+
}
|
|
28607
|
+
|
|
28413
28608
|
const PRESETS$1 = {
|
|
28414
28609
|
"default": {
|
|
28415
28610
|
pointSize: 4,
|
|
@@ -29796,6 +29991,14 @@ class Scene extends Component {
|
|
|
29796
29991
|
enabled: cfg.saoEnabled
|
|
29797
29992
|
});
|
|
29798
29993
|
|
|
29994
|
+
/** Configures Cross Sections for this Scene.
|
|
29995
|
+
* @type {CrossSections}
|
|
29996
|
+
* @final
|
|
29997
|
+
*/
|
|
29998
|
+
this.crossSections = new CrossSections(this, {
|
|
29999
|
+
|
|
30000
|
+
});
|
|
30001
|
+
|
|
29799
30002
|
this.ticksPerRender = cfg.ticksPerRender;
|
|
29800
30003
|
this.ticksPerOcclusionTest = cfg.ticksPerOcclusionTest;
|
|
29801
30004
|
this.passes = cfg.passes;
|
|
@@ -50058,6 +50261,10 @@ class VBORenderer {
|
|
|
50058
50261
|
const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
|
|
50059
50262
|
const baseIndex = layerIndex * numSectionPlanes;
|
|
50060
50263
|
const renderFlags = model.renderFlags;
|
|
50264
|
+
if (scene.crossSections) {
|
|
50265
|
+
gl.uniform4fv(this._uSliceColor, scene.crossSections.sliceColor);
|
|
50266
|
+
gl.uniform1f(this._uSliceThickness, scene.crossSections.sliceThickness);
|
|
50267
|
+
}
|
|
50061
50268
|
for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
|
|
50062
50269
|
const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
|
|
50063
50270
|
if (sectionPlaneUniforms) {
|
|
@@ -50219,6 +50426,11 @@ class VBORenderer {
|
|
|
50219
50426
|
|
|
50220
50427
|
this._uPointSize = program.getLocation("pointSize");
|
|
50221
50428
|
this._uNearPlaneHeight = program.getLocation("nearPlaneHeight");
|
|
50429
|
+
|
|
50430
|
+
if (scene.crossSections) {
|
|
50431
|
+
this._uSliceColor = program.getLocation("sliceColor");
|
|
50432
|
+
this._uSliceThickness = program.getLocation("sliceThickness");
|
|
50433
|
+
}
|
|
50222
50434
|
}
|
|
50223
50435
|
|
|
50224
50436
|
_bindProgram(frameCtx) {
|
|
@@ -50758,7 +50970,7 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50758
50970
|
|
|
50759
50971
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
50760
50972
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
50761
|
-
|
|
50973
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
50762
50974
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
50763
50975
|
}
|
|
50764
50976
|
if (clipping) {
|
|
@@ -50813,11 +51025,14 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50813
51025
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
50814
51026
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
50815
51027
|
}
|
|
51028
|
+
src.push("uniform float sliceThickness;");
|
|
51029
|
+
src.push("uniform vec4 sliceColor;");
|
|
50816
51030
|
}
|
|
50817
51031
|
src.push("in vec4 vColor;");
|
|
50818
51032
|
src.push("out vec4 outColor;");
|
|
50819
51033
|
src.push("void main(void) {");
|
|
50820
|
-
|
|
51034
|
+
src.push(" vec4 newColor;");
|
|
51035
|
+
src.push(" newColor = vColor;");
|
|
50821
51036
|
if (clipping) {
|
|
50822
51037
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
50823
51038
|
src.push(" if (clippable) {");
|
|
@@ -50827,9 +51042,12 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50827
51042
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
50828
51043
|
src.push("}");
|
|
50829
51044
|
}
|
|
50830
|
-
|
|
50831
|
-
|
|
50832
|
-
|
|
51045
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
51046
|
+
src.push(" discard;");
|
|
51047
|
+
src.push(" }");
|
|
51048
|
+
src.push(" if (dist > 0.0) { ");
|
|
51049
|
+
src.push(" newColor = sliceColor;");
|
|
51050
|
+
src.push(" }");
|
|
50833
51051
|
src.push("}");
|
|
50834
51052
|
}
|
|
50835
51053
|
|
|
@@ -50846,9 +51064,9 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50846
51064
|
src.push(" float blendFactor = uSAOParams[3];");
|
|
50847
51065
|
src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
|
|
50848
51066
|
src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
|
|
50849
|
-
src.push(" outColor = vec4(
|
|
51067
|
+
src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");
|
|
50850
51068
|
} else {
|
|
50851
|
-
src.push(" outColor =
|
|
51069
|
+
src.push(" outColor = newColor;");
|
|
50852
51070
|
}
|
|
50853
51071
|
|
|
50854
51072
|
src.push("}");
|
|
@@ -50981,6 +51199,8 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
50981
51199
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
50982
51200
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
50983
51201
|
}
|
|
51202
|
+
src.push("uniform float sliceThickness;");
|
|
51203
|
+
src.push("uniform vec4 sliceColor;");
|
|
50984
51204
|
}
|
|
50985
51205
|
|
|
50986
51206
|
this._addMatricesUniformBlockLines(src);
|
|
@@ -51009,7 +51229,8 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51009
51229
|
src.push("out vec4 outColor;");
|
|
51010
51230
|
|
|
51011
51231
|
src.push("void main(void) {");
|
|
51012
|
-
|
|
51232
|
+
src.push(" vec4 newColor;");
|
|
51233
|
+
src.push(" newColor = vColor;");
|
|
51013
51234
|
if (clipping) {
|
|
51014
51235
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
51015
51236
|
src.push(" if (clippable) {");
|
|
@@ -51019,9 +51240,12 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51019
51240
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
51020
51241
|
src.push("}");
|
|
51021
51242
|
}
|
|
51022
|
-
src.push(" if (dist >
|
|
51243
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
51023
51244
|
src.push(" discard;");
|
|
51024
51245
|
src.push(" }");
|
|
51246
|
+
src.push(" if (dist > 0.0) { ");
|
|
51247
|
+
src.push(" newColor = sliceColor;");
|
|
51248
|
+
src.push(" }");
|
|
51025
51249
|
src.push("}");
|
|
51026
51250
|
}
|
|
51027
51251
|
|
|
@@ -51065,7 +51289,7 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51065
51289
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
51066
51290
|
}
|
|
51067
51291
|
|
|
51068
|
-
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
51292
|
+
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
51069
51293
|
|
|
51070
51294
|
if (this._withSAO) {
|
|
51071
51295
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -51108,7 +51332,7 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51108
51332
|
const src = [];
|
|
51109
51333
|
src.push("#version 300 es");
|
|
51110
51334
|
src.push("// Triangles batching silhouette vertex shader");
|
|
51111
|
-
|
|
51335
|
+
|
|
51112
51336
|
src.push("uniform int renderPass;");
|
|
51113
51337
|
|
|
51114
51338
|
src.push("in vec3 position;");
|
|
@@ -51160,7 +51384,7 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51160
51384
|
src.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));");
|
|
51161
51385
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
51162
51386
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51163
|
-
|
|
51387
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
51164
51388
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
51165
51389
|
}
|
|
51166
51390
|
src.push("gl_Position = clipPos;");
|
|
@@ -51178,7 +51402,7 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51178
51402
|
const src = [];
|
|
51179
51403
|
src.push("#version 300 es");
|
|
51180
51404
|
src.push("// Triangles batching silhouette fragment shader");
|
|
51181
|
-
|
|
51405
|
+
|
|
51182
51406
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
51183
51407
|
src.push("precision highp float;");
|
|
51184
51408
|
src.push("precision highp int;");
|
|
@@ -51199,26 +51423,35 @@ class TrianglesSilhouetteRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
51199
51423
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
51200
51424
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
51201
51425
|
}
|
|
51426
|
+
src.push("uniform float sliceThickness;");
|
|
51427
|
+
src.push("uniform vec4 sliceColor;");
|
|
51202
51428
|
}
|
|
51203
51429
|
src.push("in vec4 vColor;");
|
|
51204
51430
|
src.push("out vec4 outColor;");
|
|
51205
51431
|
src.push("void main(void) {");
|
|
51432
|
+
src.push(" vec4 newColor;");
|
|
51433
|
+
src.push(" newColor = vColor;");
|
|
51206
51434
|
if (clipping) {
|
|
51207
51435
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
51208
51436
|
src.push(" if (clippable) {");
|
|
51209
51437
|
src.push(" float dist = 0.0;");
|
|
51210
|
-
for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
|
|
51438
|
+
for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
|
|
51211
51439
|
src.push("if (sectionPlaneActive" + i + ") {");
|
|
51212
51440
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
51213
51441
|
src.push("}");
|
|
51214
51442
|
}
|
|
51215
|
-
src.push(" if (dist >
|
|
51443
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
51444
|
+
src.push(" discard;");
|
|
51445
|
+
src.push(" }");
|
|
51446
|
+
src.push(" if (dist > 0.0) { ");
|
|
51447
|
+
src.push(" newColor = sliceColor;");
|
|
51448
|
+
src.push(" }");
|
|
51216
51449
|
src.push("}");
|
|
51217
51450
|
}
|
|
51218
51451
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51219
51452
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
51220
51453
|
}
|
|
51221
|
-
src.push("outColor =
|
|
51454
|
+
src.push("outColor = newColor;");
|
|
51222
51455
|
src.push("}");
|
|
51223
51456
|
return src;
|
|
51224
51457
|
}
|
|
@@ -51304,7 +51537,7 @@ class EdgesEmphasisRenderer$1 extends EdgesRenderer$1 {
|
|
|
51304
51537
|
|
|
51305
51538
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
51306
51539
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51307
|
-
|
|
51540
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
51308
51541
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
51309
51542
|
}
|
|
51310
51543
|
src.push("gl_Position = clipPos;");
|
|
@@ -51321,7 +51554,7 @@ class EdgesEmphasisRenderer$1 extends EdgesRenderer$1 {
|
|
|
51321
51554
|
const src = [];
|
|
51322
51555
|
src.push("#version 300 es");
|
|
51323
51556
|
src.push("// EdgesEmphasisRenderer fragment shader");
|
|
51324
|
-
|
|
51557
|
+
|
|
51325
51558
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
51326
51559
|
src.push("precision highp float;");
|
|
51327
51560
|
src.push("precision highp int;");
|
|
@@ -51434,7 +51667,7 @@ class EdgesColorRenderer$1 extends EdgesRenderer$1 {
|
|
|
51434
51667
|
|
|
51435
51668
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
51436
51669
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
51437
|
-
|
|
51670
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
51438
51671
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
51439
51672
|
}
|
|
51440
51673
|
src.push("gl_Position = clipPos;");
|
|
@@ -53187,6 +53420,8 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53187
53420
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
53188
53421
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
53189
53422
|
}
|
|
53423
|
+
src.push("uniform float sliceThickness;");
|
|
53424
|
+
src.push("uniform vec4 sliceColor;");
|
|
53190
53425
|
}
|
|
53191
53426
|
this._addMatricesUniformBlockLines(src);
|
|
53192
53427
|
src.push("uniform vec4 lightAmbient;");
|
|
@@ -53214,7 +53449,8 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53214
53449
|
src.push("out vec4 outColor;");
|
|
53215
53450
|
|
|
53216
53451
|
src.push("void main(void) {");
|
|
53217
|
-
|
|
53452
|
+
src.push(" vec4 newColor;");
|
|
53453
|
+
src.push(" newColor = vColor;");
|
|
53218
53454
|
if (clipping) {
|
|
53219
53455
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
53220
53456
|
src.push(" if (clippable) {");
|
|
@@ -53224,9 +53460,12 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53224
53460
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
53225
53461
|
src.push("}");
|
|
53226
53462
|
}
|
|
53227
|
-
src.push(" if (dist >
|
|
53463
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
53228
53464
|
src.push(" discard;");
|
|
53229
53465
|
src.push(" }");
|
|
53466
|
+
src.push(" if (dist > 0.0) { ");
|
|
53467
|
+
src.push(" newColor = sliceColor;");
|
|
53468
|
+
src.push(" }");
|
|
53230
53469
|
src.push("}");
|
|
53231
53470
|
}
|
|
53232
53471
|
|
|
@@ -53270,7 +53509,7 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53270
53509
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
53271
53510
|
}
|
|
53272
53511
|
|
|
53273
|
-
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
53512
|
+
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
53274
53513
|
if (gammaOutput) {
|
|
53275
53514
|
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
53276
53515
|
} else {
|
|
@@ -56051,11 +56290,14 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56051
56290
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
56052
56291
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
56053
56292
|
}
|
|
56293
|
+
src.push("uniform float sliceThickness;");
|
|
56294
|
+
src.push("uniform vec4 sliceColor;");
|
|
56054
56295
|
}
|
|
56055
56296
|
src.push("in vec4 vColor;");
|
|
56056
56297
|
src.push("out vec4 outColor;");
|
|
56057
56298
|
src.push("void main(void) {");
|
|
56058
|
-
|
|
56299
|
+
src.push(" vec4 newColor;");
|
|
56300
|
+
src.push(" newColor = vColor;");
|
|
56059
56301
|
if (clipping) {
|
|
56060
56302
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
56061
56303
|
src.push(" if (clippable) {");
|
|
@@ -56065,9 +56307,12 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56065
56307
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
56066
56308
|
src.push("}");
|
|
56067
56309
|
}
|
|
56068
|
-
src.push(" if (dist >
|
|
56310
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
56069
56311
|
src.push(" discard;");
|
|
56070
56312
|
src.push(" }");
|
|
56313
|
+
src.push(" if (dist > 0.0) { ");
|
|
56314
|
+
src.push(" newColor = sliceColor;");
|
|
56315
|
+
src.push(" }");
|
|
56071
56316
|
src.push("}");
|
|
56072
56317
|
}
|
|
56073
56318
|
|
|
@@ -56085,9 +56330,9 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56085
56330
|
src.push(" float blendFactor = uSAOParams[3];");
|
|
56086
56331
|
src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
|
|
56087
56332
|
src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
|
|
56088
|
-
src.push(" outColor = vec4(
|
|
56333
|
+
src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");
|
|
56089
56334
|
} else {
|
|
56090
|
-
src.push(" outColor =
|
|
56335
|
+
src.push(" outColor = newColor;");
|
|
56091
56336
|
}
|
|
56092
56337
|
src.push("}");
|
|
56093
56338
|
return src;
|
|
@@ -56112,7 +56357,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56112
56357
|
const src = [];
|
|
56113
56358
|
src.push("#version 300 es");
|
|
56114
56359
|
src.push("// Instancing geometry flat-shading drawing vertex shader");
|
|
56115
|
-
|
|
56360
|
+
|
|
56116
56361
|
src.push("uniform int renderPass;");
|
|
56117
56362
|
|
|
56118
56363
|
src.push("in vec3 position;");
|
|
@@ -56137,7 +56382,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56137
56382
|
src.push("}");
|
|
56138
56383
|
src.push("out float isPerspective;");
|
|
56139
56384
|
}
|
|
56140
|
-
|
|
56385
|
+
|
|
56141
56386
|
if (clipping) {
|
|
56142
56387
|
src.push("out vec4 vWorldPosition;");
|
|
56143
56388
|
src.push("out float vFlags;");
|
|
@@ -56169,7 +56414,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56169
56414
|
|
|
56170
56415
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
56171
56416
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56172
|
-
|
|
56417
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
56173
56418
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
56174
56419
|
}
|
|
56175
56420
|
|
|
@@ -56194,7 +56439,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56194
56439
|
const src = [];
|
|
56195
56440
|
src.push("#version 300 es");
|
|
56196
56441
|
src.push("// Instancing geometry flat-shading drawing fragment shader");
|
|
56197
|
-
|
|
56442
|
+
|
|
56198
56443
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
56199
56444
|
src.push("precision highp float;");
|
|
56200
56445
|
src.push("precision highp int;");
|
|
@@ -56203,9 +56448,9 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56203
56448
|
src.push("precision mediump int;");
|
|
56204
56449
|
src.push("#endif");
|
|
56205
56450
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56206
|
-
|
|
56207
|
-
|
|
56208
|
-
|
|
56451
|
+
src.push("in float isPerspective;");
|
|
56452
|
+
src.push("uniform float logDepthBufFC;");
|
|
56453
|
+
src.push("in float vFragDepth;");
|
|
56209
56454
|
}
|
|
56210
56455
|
if (this._withSAO) {
|
|
56211
56456
|
src.push("uniform sampler2D uOcclusionTexture;");
|
|
@@ -56228,6 +56473,8 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56228
56473
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
56229
56474
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
56230
56475
|
}
|
|
56476
|
+
src.push("uniform float sliceThickness;");
|
|
56477
|
+
src.push("uniform vec4 sliceColor;");
|
|
56231
56478
|
}
|
|
56232
56479
|
|
|
56233
56480
|
this._addMatricesUniformBlockLines(src);
|
|
@@ -56257,7 +56504,8 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56257
56504
|
src.push("out vec4 outColor;");
|
|
56258
56505
|
|
|
56259
56506
|
src.push("void main(void) {");
|
|
56260
|
-
|
|
56507
|
+
src.push(" vec4 newColor;");
|
|
56508
|
+
src.push(" newColor = vColor;");
|
|
56261
56509
|
if (clipping) {
|
|
56262
56510
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
56263
56511
|
src.push(" if (clippable) {");
|
|
@@ -56267,9 +56515,12 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56267
56515
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
56268
56516
|
src.push("}");
|
|
56269
56517
|
}
|
|
56270
|
-
src.push(" if (dist >
|
|
56518
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
56271
56519
|
src.push(" discard;");
|
|
56272
56520
|
src.push(" }");
|
|
56521
|
+
src.push(" if (dist > 0.0) { ");
|
|
56522
|
+
src.push(" newColor = sliceColor;");
|
|
56523
|
+
src.push(" }");
|
|
56273
56524
|
src.push("}");
|
|
56274
56525
|
}
|
|
56275
56526
|
|
|
@@ -56312,7 +56563,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
56312
56563
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
56313
56564
|
}
|
|
56314
56565
|
|
|
56315
|
-
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
56566
|
+
src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
56316
56567
|
|
|
56317
56568
|
if (this._withSAO) {
|
|
56318
56569
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -56354,7 +56605,7 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56354
56605
|
const src = [];
|
|
56355
56606
|
src.push("#version 300 es");
|
|
56356
56607
|
src.push("// Instancing silhouette vertex shader");
|
|
56357
|
-
|
|
56608
|
+
|
|
56358
56609
|
src.push("uniform int renderPass;");
|
|
56359
56610
|
|
|
56360
56611
|
src.push("in vec3 position;");
|
|
@@ -56413,7 +56664,7 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56413
56664
|
src.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));");
|
|
56414
56665
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
56415
56666
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56416
|
-
|
|
56667
|
+
src.push("vFragDepth = 1.0 + clipPos.w;");
|
|
56417
56668
|
src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
|
|
56418
56669
|
}
|
|
56419
56670
|
src.push("gl_Position = clipPos;");
|
|
@@ -56429,7 +56680,7 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56429
56680
|
const src = [];
|
|
56430
56681
|
src.push("#version 300 es");
|
|
56431
56682
|
src.push("// Instancing fill fragment shader");
|
|
56432
|
-
|
|
56683
|
+
|
|
56433
56684
|
src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
|
|
56434
56685
|
src.push("precision highp float;");
|
|
56435
56686
|
src.push("precision highp int;");
|
|
@@ -56450,10 +56701,14 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56450
56701
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
56451
56702
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
56452
56703
|
}
|
|
56704
|
+
src.push("uniform float sliceThickness;");
|
|
56705
|
+
src.push("uniform vec4 sliceColor;");
|
|
56453
56706
|
}
|
|
56454
56707
|
src.push("in vec4 vColor;");
|
|
56455
56708
|
src.push("out vec4 outColor;");
|
|
56456
56709
|
src.push("void main(void) {");
|
|
56710
|
+
src.push(" vec4 newColor;");
|
|
56711
|
+
src.push(" newColor = vColor;");
|
|
56457
56712
|
if (clipping) {
|
|
56458
56713
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
56459
56714
|
src.push(" if (clippable) {");
|
|
@@ -56463,13 +56718,18 @@ class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {
|
|
|
56463
56718
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
56464
56719
|
src.push("}");
|
|
56465
56720
|
}
|
|
56466
|
-
src.push("if (dist >
|
|
56721
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
56722
|
+
src.push(" discard;");
|
|
56723
|
+
src.push(" }");
|
|
56724
|
+
src.push(" if (dist > 0.0) { ");
|
|
56725
|
+
src.push(" newColor = sliceColor;");
|
|
56726
|
+
src.push(" }");
|
|
56467
56727
|
src.push("}");
|
|
56468
56728
|
}
|
|
56469
56729
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
56470
56730
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
56471
56731
|
}
|
|
56472
|
-
src.push("outColor =
|
|
56732
|
+
src.push("outColor = newColor;");
|
|
56473
56733
|
src.push("}");
|
|
56474
56734
|
return src;
|
|
56475
56735
|
}
|
|
@@ -58499,6 +58759,8 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58499
58759
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
58500
58760
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
58501
58761
|
}
|
|
58762
|
+
src.push("uniform float sliceThickness;");
|
|
58763
|
+
src.push("uniform vec4 sliceColor;");
|
|
58502
58764
|
}
|
|
58503
58765
|
this._addMatricesUniformBlockLines(src);
|
|
58504
58766
|
|
|
@@ -58527,7 +58789,8 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58527
58789
|
src.push("out vec4 outColor;");
|
|
58528
58790
|
|
|
58529
58791
|
src.push("void main(void) {");
|
|
58530
|
-
|
|
58792
|
+
src.push(" vec4 newColor;");
|
|
58793
|
+
src.push(" newColor = vColor;");
|
|
58531
58794
|
if (clipping) {
|
|
58532
58795
|
src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
|
|
58533
58796
|
src.push(" if (clippable) {");
|
|
@@ -58537,9 +58800,12 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58537
58800
|
src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
|
|
58538
58801
|
src.push("}");
|
|
58539
58802
|
}
|
|
58540
|
-
src.push(" if (dist >
|
|
58803
|
+
src.push(" if (dist > sliceThickness) { ");
|
|
58541
58804
|
src.push(" discard;");
|
|
58542
58805
|
src.push(" }");
|
|
58806
|
+
src.push(" if (dist > 0.0) { ");
|
|
58807
|
+
src.push(" newColor = sliceColor;");
|
|
58808
|
+
src.push(" }");
|
|
58543
58809
|
src.push("}");
|
|
58544
58810
|
}
|
|
58545
58811
|
|
|
@@ -58582,7 +58848,7 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58582
58848
|
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
58583
58849
|
}
|
|
58584
58850
|
|
|
58585
|
-
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a *
|
|
58851
|
+
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");
|
|
58586
58852
|
if (gammaOutput) {
|
|
58587
58853
|
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
58588
58854
|
} else {
|
|
@@ -58599,9 +58865,9 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
58599
58865
|
src.push(" float blendFactor = uSAOParams[3];");
|
|
58600
58866
|
src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
|
|
58601
58867
|
src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
|
|
58602
|
-
src.push(" outColor = vec4(
|
|
58868
|
+
src.push(" outColor = vec4(newColor.rgb * colorTexel.rgb * ambient, opacity);");
|
|
58603
58869
|
} else {
|
|
58604
|
-
src.push(" outColor = vec4(
|
|
58870
|
+
src.push(" outColor = vec4(newColor.rgb * colorTexel.rgb, opacity);");
|
|
58605
58871
|
}
|
|
58606
58872
|
|
|
58607
58873
|
if (gammaOutput) {
|
|
@@ -80423,7 +80689,7 @@ class SceneModelTransform {
|
|
|
80423
80689
|
this._childTransforms.push(childTransform);
|
|
80424
80690
|
childTransform._parentTransform = this;
|
|
80425
80691
|
childTransform._transformDirty();
|
|
80426
|
-
childTransform.
|
|
80692
|
+
childTransform._setSubtreeAABBsDirty(this);
|
|
80427
80693
|
}
|
|
80428
80694
|
|
|
80429
80695
|
_addMesh(mesh) {
|
|
@@ -87079,7 +87345,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87079
87345
|
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87080
87346
|
* and rebinds various input handlers.
|
|
87081
87347
|
*
|
|
87082
|
-
* @param
|
|
87348
|
+
* @param snapping
|
|
87083
87349
|
*/
|
|
87084
87350
|
set snapping(snapping) {
|
|
87085
87351
|
if (snapping !== this._snapping) {
|
|
@@ -87095,13 +87361,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87095
87361
|
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87096
87362
|
*
|
|
87097
87363
|
* This is `true` by default.
|
|
87098
|
-
*
|
|
87099
|
-
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87364
|
+
* @returns {*}
|
|
87100
87365
|
*/
|
|
87101
87366
|
get snapping() {
|
|
87102
87367
|
return this._snapping;
|
|
87103
87368
|
}
|
|
87104
|
-
|
|
87369
|
+
|
|
87105
87370
|
/**
|
|
87106
87371
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
87107
87372
|
*/
|
|
@@ -87136,12 +87401,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87136
87401
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
87137
87402
|
|
|
87138
87403
|
const pagePos = math.vec2();
|
|
87139
|
-
|
|
87404
|
+
|
|
87140
87405
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
87141
87406
|
this._snapping
|
|
87142
87407
|
? "hoverSnapOrSurface"
|
|
87143
87408
|
: "hoverSurface", event => {
|
|
87144
|
-
|
|
87409
|
+
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87145
87410
|
mouseHovering = true;
|
|
87146
87411
|
pointerWorldPos.set(event.worldPos);
|
|
87147
87412
|
pointerCanvasPos.set(event.canvasPos);
|
|
@@ -87169,7 +87434,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87169
87434
|
} else {
|
|
87170
87435
|
if (this.pointerLens) {
|
|
87171
87436
|
this.pointerLens.visible = true;
|
|
87172
|
-
this.pointerLens.canvasPos =
|
|
87437
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87173
87438
|
this.pointerLens.snappedCanvasPos = event.canvasPos;
|
|
87174
87439
|
this.pointerLens.snapped = false;
|
|
87175
87440
|
}
|
|
@@ -87203,7 +87468,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87203
87468
|
pointerDownCanvasY = e.clientY;
|
|
87204
87469
|
});
|
|
87205
87470
|
|
|
87206
|
-
canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
|
|
87471
|
+
canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
|
|
87207
87472
|
if (e.which !== 1) {
|
|
87208
87473
|
return;
|
|
87209
87474
|
}
|
|
@@ -87258,21 +87523,21 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87258
87523
|
this._snapping
|
|
87259
87524
|
? "hoverSnapOrSurfaceOff"
|
|
87260
87525
|
: "hoverOff", event => {
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87272
|
-
|
|
87273
|
-
|
|
87274
|
-
|
|
87275
|
-
|
|
87526
|
+
if (this.pointerLens) {
|
|
87527
|
+
this.pointerLens.visible = true;
|
|
87528
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87529
|
+
this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87530
|
+
}
|
|
87531
|
+
mouseHovering = false;
|
|
87532
|
+
this._markerDiv.style.left = `-100px`;
|
|
87533
|
+
this._markerDiv.style.top = `-100px`;
|
|
87534
|
+
if (this._currentDistanceMeasurement) {
|
|
87535
|
+
this._currentDistanceMeasurement.wireVisible = false;
|
|
87536
|
+
this._currentDistanceMeasurement.targetVisible = false;
|
|
87537
|
+
this._currentDistanceMeasurement.axisVisible = false;
|
|
87538
|
+
}
|
|
87539
|
+
canvas.style.cursor = "default";
|
|
87540
|
+
});
|
|
87276
87541
|
|
|
87277
87542
|
this._active = true;
|
|
87278
87543
|
}
|
|
@@ -87947,8 +88212,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87947
88212
|
this._onCanvasTouchStart = null;
|
|
87948
88213
|
this._onCanvasTouchEnd = null;
|
|
87949
88214
|
this._longTouchTimeoutMs = 300;
|
|
87950
|
-
this.
|
|
87951
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
88215
|
+
this._snapping = cfg.snapping !== false;
|
|
87952
88216
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
87953
88217
|
|
|
87954
88218
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
@@ -87978,39 +88242,35 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87978
88242
|
}
|
|
87979
88243
|
|
|
87980
88244
|
/**
|
|
87981
|
-
* Sets whether snap-to-vertex
|
|
87982
|
-
*
|
|
87983
|
-
* @param snapToVertex
|
|
87984
|
-
*/
|
|
87985
|
-
set snapToVertex(snapToVertex) {
|
|
87986
|
-
this._snapToVertex = snapToVertex;
|
|
87987
|
-
}
|
|
87988
|
-
|
|
87989
|
-
/**
|
|
87990
|
-
* Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
|
|
87991
|
-
* This is `true` by default.
|
|
87992
|
-
* @returns {*}
|
|
87993
|
-
*/
|
|
87994
|
-
get snapToVertex() {
|
|
87995
|
-
return this._snapToVertex;
|
|
87996
|
-
}
|
|
87997
|
-
|
|
87998
|
-
/**
|
|
87999
|
-
* Sets whether snap-to-edge is enabled for this DistanceMeasurementsTouchControl.
|
|
88245
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88246
|
+
*
|
|
88000
88247
|
* This is `true` by default.
|
|
88001
|
-
*
|
|
88248
|
+
*
|
|
88249
|
+
* Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that
|
|
88250
|
+
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
88251
|
+
* and rebinds various input handlers.
|
|
88252
|
+
*
|
|
88253
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.
|
|
88002
88254
|
*/
|
|
88003
|
-
set
|
|
88004
|
-
this.
|
|
88255
|
+
set snapping(snapping) {
|
|
88256
|
+
if (snapping !== this._snapping) {
|
|
88257
|
+
this._snapping = snapping;
|
|
88258
|
+
this.deactivate();
|
|
88259
|
+
this.activate();
|
|
88260
|
+
} else {
|
|
88261
|
+
this._snapping = snapping;
|
|
88262
|
+
}
|
|
88005
88263
|
}
|
|
88006
88264
|
|
|
88007
88265
|
/**
|
|
88008
|
-
* Gets whether snap-to-edge
|
|
88266
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88267
|
+
*
|
|
88009
88268
|
* This is `true` by default.
|
|
88010
|
-
*
|
|
88269
|
+
*
|
|
88270
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88011
88271
|
*/
|
|
88012
|
-
get
|
|
88013
|
-
return this.
|
|
88272
|
+
get snapping() {
|
|
88273
|
+
return this._snapping;
|
|
88014
88274
|
}
|
|
88015
88275
|
|
|
88016
88276
|
/**
|
|
@@ -88040,11 +88300,11 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88040
88300
|
|
|
88041
88301
|
let touchId = null;
|
|
88042
88302
|
|
|
88043
|
-
const
|
|
88303
|
+
const disableCameraNavigation = () => {
|
|
88044
88304
|
this.plugin.viewer.cameraControl.active = false;
|
|
88045
88305
|
};
|
|
88046
88306
|
|
|
88047
|
-
const
|
|
88307
|
+
const enableCameraNavigation = () => {
|
|
88048
88308
|
this.plugin.viewer.cameraControl.active = true;
|
|
88049
88309
|
};
|
|
88050
88310
|
|
|
@@ -88057,7 +88317,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88057
88317
|
this._currentDistanceMeasurement.destroy();
|
|
88058
88318
|
this._currentDistanceMeasurement = null;
|
|
88059
88319
|
}
|
|
88060
|
-
|
|
88320
|
+
enableCameraNavigation();
|
|
88061
88321
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88062
88322
|
};
|
|
88063
88323
|
|
|
@@ -88089,8 +88349,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88089
88349
|
}
|
|
88090
88350
|
const snapPickResult = scene.pick({
|
|
88091
88351
|
canvasPos: touchMoveCanvasPos,
|
|
88092
|
-
|
|
88093
|
-
snapToEdge: this.
|
|
88352
|
+
snapping: this._snapping,
|
|
88353
|
+
snapToEdge: this._snapping
|
|
88094
88354
|
});
|
|
88095
88355
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88096
88356
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -88160,7 +88420,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88160
88420
|
// }
|
|
88161
88421
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
|
|
88162
88422
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
88163
|
-
|
|
88423
|
+
disableCameraNavigation();
|
|
88164
88424
|
}, this._longTouchTimeoutMs);
|
|
88165
88425
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
|
|
88166
88426
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -88198,8 +88458,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88198
88458
|
|
|
88199
88459
|
const snapPickResult = scene.pick({
|
|
88200
88460
|
canvasPos: touchMoveCanvasPos,
|
|
88201
|
-
snapToVertex: this.
|
|
88202
|
-
snapToEdge: this.
|
|
88461
|
+
snapToVertex: this._snapping,
|
|
88462
|
+
snapToEdge: this._snapping
|
|
88203
88463
|
});
|
|
88204
88464
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88205
88465
|
if (this.pointerLens) {
|
|
@@ -88243,7 +88503,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88243
88503
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
|
|
88244
88504
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
88245
88505
|
|
|
88246
|
-
|
|
88506
|
+
disableCameraNavigation();
|
|
88247
88507
|
|
|
88248
88508
|
}, this._longTouchTimeoutMs);
|
|
88249
88509
|
|
|
@@ -88303,10 +88563,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88303
88563
|
}
|
|
88304
88564
|
snapPickResult = scene.pick({
|
|
88305
88565
|
canvasPos: touchMoveCanvasPos,
|
|
88306
|
-
|
|
88307
|
-
|
|
88308
|
-
snapToVertex: this._snapToVertex,
|
|
88309
|
-
snapToEdge: this._snapToEdge
|
|
88566
|
+
snapToVertex: this._snapping,
|
|
88567
|
+
snapToEdge: this._snapping
|
|
88310
88568
|
});
|
|
88311
88569
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
88312
88570
|
if (this.pointerLens) {
|
|
@@ -88407,8 +88665,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88407
88665
|
}
|
|
88408
88666
|
snapPickResult = scene.pick({
|
|
88409
88667
|
canvasPos: touchMoveCanvasPos,
|
|
88410
|
-
snapToVertex: this.
|
|
88411
|
-
snapToEdge: this.
|
|
88668
|
+
snapToVertex: this._snapping,
|
|
88669
|
+
snapToEdge: this._snapping
|
|
88412
88670
|
});
|
|
88413
88671
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
88414
88672
|
if (this.pointerLens) {
|
|
@@ -88514,7 +88772,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88514
88772
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88515
88773
|
}
|
|
88516
88774
|
}
|
|
88517
|
-
|
|
88775
|
+
enableCameraNavigation();
|
|
88518
88776
|
break;
|
|
88519
88777
|
|
|
88520
88778
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
|
|
@@ -88532,7 +88790,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88532
88790
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88533
88791
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
88534
88792
|
}
|
|
88535
|
-
|
|
88793
|
+
enableCameraNavigation();
|
|
88536
88794
|
break;
|
|
88537
88795
|
|
|
88538
88796
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
|
|
@@ -88565,7 +88823,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88565
88823
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88566
88824
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88567
88825
|
}
|
|
88568
|
-
|
|
88826
|
+
enableCameraNavigation();
|
|
88569
88827
|
break;
|
|
88570
88828
|
|
|
88571
88829
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:
|
|
@@ -88586,7 +88844,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88586
88844
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88587
88845
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88588
88846
|
}
|
|
88589
|
-
|
|
88847
|
+
enableCameraNavigation();
|
|
88590
88848
|
break;
|
|
88591
88849
|
}
|
|
88592
88850
|
|