@itwin/core-frontend 3.0.0-dev.105 → 3.0.0-dev.106
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/lib/cjs/ApproximateTerrainHeights.js +3 -3
- package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
- package/lib/cjs/RealityDataSource.d.ts +1 -0
- package/lib/cjs/RealityDataSource.d.ts.map +1 -1
- package/lib/cjs/RealityDataSource.js +8 -1
- package/lib/cjs/RealityDataSource.js.map +1 -1
- package/lib/cjs/TwoWayViewportSync.d.ts +35 -6
- package/lib/cjs/TwoWayViewportSync.d.ts.map +1 -1
- package/lib/cjs/TwoWayViewportSync.js +51 -11
- package/lib/cjs/TwoWayViewportSync.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +4 -2
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.js +10 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.js.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js +4 -0
- package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/tile/internal.d.ts +1 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +1 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts +22 -0
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -0
- package/lib/cjs/tile/map/ArcGISTileMap.js +173 -0
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -0
- package/lib/cjs/tile/map/CesiumTerrainProvider.js +5 -4
- package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -2
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +18 -40
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts +6 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +63 -21
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +4 -4
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +20 -24
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +17 -6
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +9 -4
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +22 -4
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTile.js +4 -3
- package/lib/cjs/tile/map/MapTile.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +1 -1
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.d.ts +7 -2
- package/lib/cjs/tile/map/MapTilingScheme.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.js +21 -8
- package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/cjs/tile/map/QuadId.d.ts +1 -0
- package/lib/cjs/tile/map/QuadId.d.ts.map +1 -1
- package/lib/cjs/tile/map/QuadId.js +2 -1
- package/lib/cjs/tile/map/QuadId.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts +7 -0
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +16 -2
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.js +3 -3
- package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
- package/lib/esm/RealityDataSource.d.ts +1 -0
- package/lib/esm/RealityDataSource.d.ts.map +1 -1
- package/lib/esm/RealityDataSource.js +8 -1
- package/lib/esm/RealityDataSource.js.map +1 -1
- package/lib/esm/TwoWayViewportSync.d.ts +35 -6
- package/lib/esm/TwoWayViewportSync.d.ts.map +1 -1
- package/lib/esm/TwoWayViewportSync.js +49 -10
- package/lib/esm/TwoWayViewportSync.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +4 -2
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.js +10 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.js.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.d.ts.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js +4 -0
- package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/tile/internal.d.ts +1 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +1 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts +22 -0
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -0
- package/lib/esm/tile/map/ArcGISTileMap.js +169 -0
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -0
- package/lib/esm/tile/map/CesiumTerrainProvider.js +5 -4
- package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -2
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +19 -41
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts +6 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +63 -21
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +4 -4
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +21 -25
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +17 -6
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +9 -4
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +22 -4
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTile.js +4 -3
- package/lib/esm/tile/map/MapTile.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +1 -1
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTilingScheme.d.ts +7 -2
- package/lib/esm/tile/map/MapTilingScheme.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTilingScheme.js +22 -9
- package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/esm/tile/map/QuadId.d.ts +1 -0
- package/lib/esm/tile/map/QuadId.d.ts.map +1 -1
- package/lib/esm/tile/map/QuadId.js +2 -1
- package/lib/esm/tile/map/QuadId.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts +7 -0
- package/lib/esm/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +16 -2
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/package.json +24 -24
|
@@ -2,21 +2,50 @@
|
|
|
2
2
|
* @module Views
|
|
3
3
|
*/
|
|
4
4
|
import { Viewport } from "./Viewport";
|
|
5
|
-
/** Forms a bidirectional connection between two [[Viewport]]s such that the [
|
|
6
|
-
* For example, panning in one viewport will cause the other viewport to pan by the same distance
|
|
5
|
+
/** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.
|
|
6
|
+
* For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport
|
|
7
|
+
* will change it in the other viewport.
|
|
8
|
+
* By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by
|
|
9
|
+
* subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.
|
|
7
10
|
* @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)
|
|
8
11
|
* for an interactive demonstration.
|
|
12
|
+
* @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.
|
|
9
13
|
* @public
|
|
10
14
|
*/
|
|
11
15
|
export declare class TwoWayViewportSync {
|
|
12
|
-
|
|
16
|
+
protected readonly _disconnect: VoidFunction[];
|
|
13
17
|
private _isEcho;
|
|
14
18
|
private syncView;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
19
|
+
/** Invoked from [[connect]] to set up the initial synchronization between the two viewports.
|
|
20
|
+
* `target` should be modified to match `source`.
|
|
21
|
+
* The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
|
|
22
|
+
* @see [[syncViewports]] to customize subsequent synchronization.
|
|
17
23
|
*/
|
|
18
|
-
|
|
24
|
+
protected connectViewports(source: Viewport, target: Viewport): void;
|
|
25
|
+
/** Invoked each time `source` changes to update `target` to match.
|
|
26
|
+
* The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
|
|
27
|
+
* @param source The viewport that changed
|
|
28
|
+
* @param target The viewport that should be updated to match `source`
|
|
29
|
+
* @see [[connectViewports]] to set up the initial synchronization between the two viewports.
|
|
30
|
+
*/
|
|
31
|
+
protected syncViewports(source: Viewport, target: Viewport): void;
|
|
32
|
+
/** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].
|
|
33
|
+
* Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].
|
|
34
|
+
*/
|
|
35
|
+
connect(viewport1: Viewport, viewport2: Viewport): void;
|
|
19
36
|
/** Remove the connection between the two views. */
|
|
20
37
|
disconnect(): void;
|
|
21
38
|
}
|
|
39
|
+
/** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.
|
|
40
|
+
* For example, zooming out in one viewport will zoom out by the same distance in the other viewport.
|
|
41
|
+
* No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.
|
|
42
|
+
* @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare class TwoWayViewportFrustumSync extends TwoWayViewportSync {
|
|
46
|
+
/** @internal override */
|
|
47
|
+
protected syncViewports(source: Viewport, target: Viewport): void;
|
|
48
|
+
/** @internal override */
|
|
49
|
+
protected connectViewports(source: Viewport, target: Viewport): void;
|
|
50
|
+
}
|
|
22
51
|
//# sourceMappingURL=TwoWayViewportSync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TwoWayViewportSync.d.ts","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"TwoWayViewportSync.d.ts","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;GASG;AACH,qBAAa,kBAAkB;IAC7B,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,EAAE,CAAM;IACpD,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,QAAQ;IAShB;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAKpE;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAIjE;;OAEG;IACI,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAUvD,mDAAmD;IAC5C,UAAU;CAIlB;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IAC/D,yBAAyB;cACN,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAM1E,yBAAyB;cACN,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;CAG9E"}
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Views
|
|
7
7
|
*/
|
|
8
|
-
/** Forms a bidirectional connection between two [[Viewport]]s such that the [
|
|
9
|
-
* For example, panning in one viewport will cause the other viewport to pan by the same distance
|
|
8
|
+
/** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.
|
|
9
|
+
* For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport
|
|
10
|
+
* will change it in the other viewport.
|
|
11
|
+
* By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by
|
|
12
|
+
* subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.
|
|
10
13
|
* @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)
|
|
11
14
|
* for an interactive demonstration.
|
|
15
|
+
* @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.
|
|
12
16
|
* @public
|
|
13
17
|
*/
|
|
14
18
|
export class TwoWayViewportSync {
|
|
@@ -20,19 +24,36 @@ export class TwoWayViewportSync {
|
|
|
20
24
|
if (this._isEcho)
|
|
21
25
|
return;
|
|
22
26
|
this._isEcho = true; // so we don't react to the echo of this sync
|
|
23
|
-
|
|
27
|
+
this.syncViewports(source, target);
|
|
24
28
|
this._isEcho = false;
|
|
25
29
|
}
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
30
|
+
/** Invoked from [[connect]] to set up the initial synchronization between the two viewports.
|
|
31
|
+
* `target` should be modified to match `source`.
|
|
32
|
+
* The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
|
|
33
|
+
* @see [[syncViewports]] to customize subsequent synchronization.
|
|
34
|
+
*/
|
|
35
|
+
connectViewports(source, target) {
|
|
36
|
+
const viewState = source.view.clone(target.iModel);
|
|
37
|
+
target.applyViewState(viewState);
|
|
38
|
+
}
|
|
39
|
+
/** Invoked each time `source` changes to update `target` to match.
|
|
40
|
+
* The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
|
|
41
|
+
* @param source The viewport that changed
|
|
42
|
+
* @param target The viewport that should be updated to match `source`
|
|
43
|
+
* @see [[connectViewports]] to set up the initial synchronization between the two viewports.
|
|
44
|
+
*/
|
|
45
|
+
syncViewports(source, target) {
|
|
46
|
+
target.applyViewState(source.view.clone(target.iModel));
|
|
47
|
+
}
|
|
48
|
+
/** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].
|
|
49
|
+
* Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].
|
|
28
50
|
*/
|
|
29
|
-
connect(
|
|
51
|
+
connect(viewport1, viewport2) {
|
|
30
52
|
this.disconnect();
|
|
31
|
-
|
|
32
|
-
view2.applyViewState(viewState2);
|
|
53
|
+
this.connectViewports(viewport1, viewport2);
|
|
33
54
|
// listen to the onViewChanged events from both views
|
|
34
|
-
this._disconnect.push(
|
|
35
|
-
this._disconnect.push(
|
|
55
|
+
this._disconnect.push(viewport1.onViewChanged.addListener(() => this.syncView(viewport1, viewport2)));
|
|
56
|
+
this._disconnect.push(viewport2.onViewChanged.addListener(() => this.syncView(viewport2, viewport1)));
|
|
36
57
|
}
|
|
37
58
|
/** Remove the connection between the two views. */
|
|
38
59
|
disconnect() {
|
|
@@ -40,4 +61,22 @@ export class TwoWayViewportSync {
|
|
|
40
61
|
this._disconnect.length = 0;
|
|
41
62
|
}
|
|
42
63
|
}
|
|
64
|
+
/** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.
|
|
65
|
+
* For example, zooming out in one viewport will zoom out by the same distance in the other viewport.
|
|
66
|
+
* No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.
|
|
67
|
+
* @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export class TwoWayViewportFrustumSync extends TwoWayViewportSync {
|
|
71
|
+
/** @internal override */
|
|
72
|
+
syncViewports(source, target) {
|
|
73
|
+
const pose = source.view.savePose();
|
|
74
|
+
const view = target.view.applyPose(pose);
|
|
75
|
+
target.applyViewState(view);
|
|
76
|
+
}
|
|
77
|
+
/** @internal override */
|
|
78
|
+
connectViewports(source, target) {
|
|
79
|
+
this.syncViewports(source, target);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
43
82
|
//# sourceMappingURL=TwoWayViewportSync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TwoWayViewportSync.js","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH
|
|
1
|
+
{"version":3,"file":"TwoWayViewportSync.js","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAkB;IAA/B;QACqB,gBAAW,GAAmB,EAAE,CAAC;QAC5C,YAAO,GAAG,KAAK,CAAC;IAiD1B,CAAC;IA/CS,QAAQ,CAAC,MAAgB,EAAE,MAAgB;QACjD,IAAI,IAAI,CAAC,OAAO;YACd,OAAO;QAET,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,6CAA6C;QAClE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACO,gBAAgB,CAAC,MAAgB,EAAE,MAAgB;QAC3D,MAAM,SAAS,GAAG,MAAM,CAA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AAC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,yBAAyB;IACN,gBAAgB,CAAC,MAAgB,EAAE,MAAgB;QACpE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { Viewport } from \"./Viewport\";\r\n\r\n/** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.\r\n * For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport\r\n * will change it in the other viewport.\r\n * By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by\r\n * subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.\r\n * @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)\r\n * for an interactive demonstration.\r\n * @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.\r\n * @public\r\n */\r\nexport class TwoWayViewportSync {\r\n protected readonly _disconnect: VoidFunction[] = [];\r\n private _isEcho = false;\r\n\r\n private syncView(source: Viewport, target: Viewport) {\r\n if (this._isEcho)\r\n return;\r\n\r\n this._isEcho = true; // so we don't react to the echo of this sync\r\n this.syncViewports(source, target);\r\n this._isEcho = false;\r\n }\r\n\r\n /** Invoked from [[connect]] to set up the initial synchronization between the two viewports.\r\n * `target` should be modified to match `source`.\r\n * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.\r\n * @see [[syncViewports]] to customize subsequent synchronization.\r\n */\r\n protected connectViewports(source: Viewport, target: Viewport): void {\r\n const viewState = source.view.clone(target.iModel);\r\n target.applyViewState(viewState);\r\n }\r\n\r\n /** Invoked each time `source` changes to update `target` to match.\r\n * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.\r\n * @param source The viewport that changed\r\n * @param target The viewport that should be updated to match `source`\r\n * @see [[connectViewports]] to set up the initial synchronization between the two viewports.\r\n */\r\n protected syncViewports(source: Viewport, target: Viewport): void {\r\n target.applyViewState(source.view.clone(target.iModel));\r\n }\r\n\r\n /** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].\r\n * Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].\r\n */\r\n public connect(viewport1: Viewport, viewport2: Viewport) {\r\n this.disconnect();\r\n\r\n this.connectViewports(viewport1, viewport2);\r\n\r\n // listen to the onViewChanged events from both views\r\n this._disconnect.push(viewport1.onViewChanged.addListener(() => this.syncView(viewport1, viewport2)));\r\n this._disconnect.push(viewport2.onViewChanged.addListener(() => this.syncView(viewport2, viewport1)));\r\n }\r\n\r\n /** Remove the connection between the two views. */\r\n public disconnect() {\r\n this._disconnect.forEach((f) => f());\r\n this._disconnect.length = 0;\r\n }\r\n}\r\n\r\n/** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.\r\n * For example, zooming out in one viewport will zoom out by the same distance in the other viewport.\r\n * No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.\r\n * @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.\r\n * @public\r\n */\r\nexport class TwoWayViewportFrustumSync extends TwoWayViewportSync {\r\n /** @internal override */\r\n protected override syncViewports(source: Viewport, target: Viewport): void {\r\n const pose = source.view.savePose();\r\n const view = target.view.applyPose(pose);\r\n target.applyViewState(view);\r\n }\r\n\r\n /** @internal override */\r\n protected override connectViewports(source: Viewport, target: Viewport): void {\r\n this.syncViewports(source, target);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarClassif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AAC,UAAU,GAAG,IAAI;IAc9D,IAAW,UAAU,IAAI,OAAO,CAAkD;IAE3E,OAAO;IAOd,IAAW,OAAO,IAAI,OAAO,GAAG,SAAS,CAWxC;IAED,OAAO,CAAC,WAAW;IAWZ,cAAc,CAAC,UAAU,EAAE,UAAU;IAMrC,SAAS,CAAC,iBAAiB,CAAC,EAAE,kCAAkC,EAAE,cAAc,CAAC,EAAE,mBAAmB;IAMtG,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAmE5E,IAAI,CAAC,MAAM,EAAE,MAAM;CAmI3B"}
|
|
@@ -279,11 +279,13 @@ export class PlanarClassifier extends RenderPlanarClassifier {
|
|
|
279
279
|
this._renderCommands = new RenderCommands(target, this._branchStack, this._batchState);
|
|
280
280
|
}
|
|
281
281
|
getParams(params) {
|
|
282
|
-
var _a;
|
|
282
|
+
var _a, _b;
|
|
283
283
|
params[0] = this.insideDisplay;
|
|
284
284
|
params[1] = this.outsideDisplay;
|
|
285
285
|
params[2] = this._contentMode;
|
|
286
|
-
|
|
286
|
+
if ((_a = this._planarClipMask) === null || _a === void 0 ? void 0 : _a.settings.invert) // If the mask sense is inverted, negate the contentMode to indicate this to the shader.
|
|
287
|
+
params[2] = -params[2];
|
|
288
|
+
params[3] = (((_b = this._planarClipMask) === null || _b === void 0 ? void 0 : _b.settings.transparency) === undefined) ? -1 : this._planarClipMask.settings.transparency;
|
|
287
289
|
}
|
|
288
290
|
get hiliteTexture() { return undefined !== this._classifierBuffers ? this._classifierBuffers.textures.hilite : undefined; }
|
|
289
291
|
get projectionMatrix() { return this._projectionMatrix; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarClassifier.js","sourceRoot":"","sources":["../../../../src/render/webgl/PlanarClassifier.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,O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WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAE/C,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;;AAhTc,sCAAqB,GAAG,QAAQ,CAAC,eAAe,CAC7D,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EACX,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module WebGL\r\n */\r\n\r\nimport { dispose } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Plane3dByOriginAndUnitNormal, Point3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport {\r\n ColorDef, Frustum, FrustumPlanes, RenderMode, RenderTexture, SpatialClassifier, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay,\r\n} from \"@itwin/core-common\";\r\nimport { PlanarClipMaskState } from \"../../PlanarClipMaskState\";\r\nimport { GraphicsCollectorDrawArgs, SpatialClassifierTileTreeReference, TileTreeReference } from \"../../tile/internal\";\r\nimport { SceneContext } from \"../../ViewContext\";\r\nimport { ViewState3d } from \"../../ViewState\";\r\nimport { FeatureSymbology } from \"../FeatureSymbology\";\r\nimport { RenderGraphic } from \"../RenderGraphic\";\r\nimport { RenderMemory } from \"../RenderMemory\";\r\nimport { PlanarClassifierTarget, RenderPlanarClassifier } from \"../RenderPlanarClassifier\";\r\nimport { BatchState } from \"./BatchState\";\r\nimport { BranchStack } from \"./BranchStack\";\r\nimport { CachedGeometry, Combine3TexturesGeometry, CombineTexturesGeometry, ViewportQuadGeometry } from \"./CachedGeometry\";\r\nimport { WebGLDisposable } from \"./Disposable\";\r\nimport { DrawCommands } from \"./DrawCommand\";\r\nimport { FrameBuffer } from \"./FrameBuffer\";\r\nimport { GL } from \"./GL\";\r\nimport { Batch, Branch } from \"./Graphic\";\r\nimport { PlanarTextureProjection } from \"./PlanarTextureProjection\";\r\nimport { RenderCommands } from \"./RenderCommands\";\r\nimport { RenderPass } from \"./RenderFlags\";\r\nimport { RenderState } from \"./RenderState\";\r\nimport { getDrawParams } from \"./ScratchDrawParams\";\r\nimport { System } from \"./System\";\r\nimport { Target } from \"./Target\";\r\nimport { TechniqueId } from \"./TechniqueId\";\r\nimport { Texture, TextureHandle } from \"./Texture\";\r\n\r\nexport enum PlanarClassifierContent { None = 0, MaskOnly = 1, ClassifierOnly = 2, ClassifierAndMask = 3 }\r\n\r\nfunction createTexture(handle: TextureHandle): Texture {\r\n return new Texture({\r\n handle,\r\n ownership: \"external\",\r\n type: RenderTexture.Type.TileSection,\r\n });\r\n}\r\n\r\nfunction createTextureHandle(width: number, height: number, heightMult = 1.0) { return TextureHandle.createForAttachment(width, height * heightMult, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte); }\r\n\r\nclass ClassifierTextures implements WebGLDisposable {\r\n private constructor(public readonly color: Texture,\r\n public readonly feature: Texture,\r\n public readonly hilite: Texture) { }\r\n\r\n public get isDisposed(): boolean {\r\n return this.color.isDisposed\r\n && this.feature.isDisposed\r\n && this.hilite.isDisposed;\r\n }\r\n\r\n public dispose(): void {\r\n dispose(this.color);\r\n dispose(this.feature);\r\n dispose(this.hilite);\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n stats.addPlanarClassifier(this.color.bytesUsed);\r\n stats.addPlanarClassifier(this.feature.bytesUsed);\r\n stats.addPlanarClassifier(this.hilite.bytesUsed);\r\n }\r\n\r\n public static create(width: number, height: number): ClassifierTextures | undefined {\r\n const hColor = createTextureHandle(width, height);\r\n const hFeature = createTextureHandle(width, height);\r\n const hHilite = createTextureHandle(width, height);\r\n if (!hColor || !hFeature || !hHilite)\r\n return undefined;\r\n\r\n const color = createTexture(hColor);\r\n const feature = createTexture(hFeature);\r\n const hilite = createTexture(hHilite);\r\n if (!color || !feature || !hilite)\r\n return undefined;\r\n\r\n return new ClassifierTextures(color, feature, hilite);\r\n }\r\n}\r\n\r\nabstract class ClassifierFrameBuffers implements WebGLDisposable {\r\n protected constructor(\r\n public readonly textures: ClassifierTextures,\r\n private readonly _hilite: FrameBuffer) { }\r\n\r\n public get isDisposed(): boolean {\r\n return this.textures.isDisposed && this._hilite.isDisposed;\r\n }\r\n\r\n public dispose(): void {\r\n dispose(this.textures);\r\n dispose(this._hilite);\r\n }\r\n\r\n public abstract draw(cmds: DrawCommands, target: Target): void;\r\n\r\n public drawHilite(cmds: DrawCommands, target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n system.frameBufferStack.execute(this._hilite, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n target.techniques.execute(target, cmds, RenderPass.Hilite);\r\n });\r\n }\r\n\r\n public static create(width: number, height: number): ClassifierFrameBuffers | undefined {\r\n const textures = ClassifierTextures.create(width, height);\r\n if (undefined === textures)\r\n return undefined;\r\n\r\n const hiliteFbo = FrameBuffer.create([textures.hilite.texture]);\r\n if (undefined === hiliteFbo)\r\n return undefined;\r\n\r\n if (System.instance.capabilities.supportsDrawBuffers)\r\n return ClassifierMRTFrameBuffers.createMRT(textures, hiliteFbo);\r\n else\r\n return ClassifierMPFrameBuffers.createMP(textures, hiliteFbo);\r\n }\r\n}\r\n\r\nclass ClassifierMRTFrameBuffers extends ClassifierFrameBuffers {\r\n private readonly _fbo: FrameBuffer;\r\n private readonly _clearGeom: ViewportQuadGeometry;\r\n\r\n private constructor(textures: ClassifierTextures, hilite: FrameBuffer, fbo: FrameBuffer, geom: ViewportQuadGeometry) {\r\n super(textures, hilite);\r\n this._fbo = fbo;\r\n this._clearGeom = geom;\r\n }\r\n\r\n public override get isDisposed(): boolean {\r\n return super.isDisposed\r\n && this._fbo.isDisposed\r\n && this._clearGeom.isDisposed;\r\n }\r\n\r\n public override dispose(): void {\r\n dispose(this._fbo);\r\n dispose(this._clearGeom);\r\n super.dispose();\r\n }\r\n\r\n public static createMRT(textures: ClassifierTextures, hilite: FrameBuffer): ClassifierMRTFrameBuffers | undefined {\r\n const fbo = FrameBuffer.create([textures.color.texture, textures.feature.texture]);\r\n if (undefined === fbo)\r\n return undefined;\r\n\r\n const geom = ViewportQuadGeometry.create(TechniqueId.ClearPickAndColor);\r\n return undefined !== geom ? new ClassifierMRTFrameBuffers(textures, hilite, fbo, geom) : undefined;\r\n }\r\n\r\n public draw(cmds: DrawCommands, target: Target): void {\r\n System.instance.frameBufferStack.execute(this._fbo, true, false, () => {\r\n target.techniques.draw(getDrawParams(target, this._clearGeom));\r\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\r\n });\r\n }\r\n}\r\n\r\nclass ClassifierMPFrameBuffers extends ClassifierFrameBuffers {\r\n private readonly _color: FrameBuffer;\r\n private readonly _feature: FrameBuffer;\r\n\r\n private constructor(textures: ClassifierTextures, hilite: FrameBuffer, color: FrameBuffer, feature: FrameBuffer) {\r\n super(textures, hilite);\r\n this._color = color;\r\n this._feature = feature;\r\n }\r\n\r\n public override get isDisposed(): boolean {\r\n return super.isDisposed\r\n && this._color.isDisposed\r\n && this._feature.isDisposed;\r\n }\r\n\r\n public override dispose(): void {\r\n dispose(this._color);\r\n dispose(this._feature);\r\n super.dispose();\r\n }\r\n\r\n public static createMP(textures: ClassifierTextures, hilite: FrameBuffer): ClassifierMPFrameBuffers | undefined {\r\n const color = FrameBuffer.create([textures.color.texture]);\r\n const feature = FrameBuffer.create([textures.feature.texture]);\r\n return undefined !== color && undefined !== feature ? new ClassifierMPFrameBuffers(textures, hilite, color, feature) : undefined;\r\n }\r\n\r\n public draw(cmds: DrawCommands, target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n const draw = (feature: boolean) => {\r\n const fbo = feature ? this._feature : this._color;\r\n system.frameBufferStack.execute(fbo, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n target.compositor.currentRenderTargetIndex = feature ? 1 : 0;\r\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\r\n });\r\n };\r\n\r\n draw(false);\r\n draw(true);\r\n }\r\n}\r\n\r\ninterface TextureAndFbo {\r\n texture: Texture;\r\n fbo: FrameBuffer;\r\n}\r\n\r\nabstract class SingleTextureFrameBuffer implements WebGLDisposable {\r\n public texture: Texture;\r\n protected fbo: FrameBuffer;\r\n public get isDisposed(): boolean { return this.texture.isDisposed && this.fbo.isDisposed; }\r\n public collectStatistics(stats: RenderMemory.Statistics): void { stats.addPlanarClassifier(this.texture.bytesUsed); }\r\n protected constructor(textureAndFbo: TextureAndFbo) {\r\n this.texture = textureAndFbo.texture;\r\n this.fbo = textureAndFbo.fbo;\r\n }\r\n public dispose(): void {\r\n dispose(this.texture);\r\n dispose(this.fbo);\r\n }\r\n public static createTextureAndFrameBuffer(width: number, height: number): TextureAndFbo | undefined {\r\n const hTexture = TextureHandle.createForAttachment(width, height, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\r\n if (!hTexture)\r\n return undefined;\r\n\r\n const texture = new Texture({ type: RenderTexture.Type.TileSection, ownership: \"external\", handle: hTexture });\r\n if (!texture)\r\n return undefined;\r\n\r\n const fbo = FrameBuffer.create([texture.texture]);\r\n if (undefined === fbo)\r\n return undefined;\r\n\r\n return { texture, fbo };\r\n }\r\n}\r\nclass MaskFrameBuffer extends SingleTextureFrameBuffer {\r\n public static create(width: number, height: number): MaskFrameBuffer | undefined {\r\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, height);\r\n return undefined === textureFbo ? undefined : new MaskFrameBuffer(textureFbo);\r\n }\r\n public draw(cmds: DrawCommands, target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n\r\n system.frameBufferStack.execute(this.fbo, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n if (!System.instance.capabilities.supportsDrawBuffers)\r\n target.compositor.currentRenderTargetIndex = 0;\r\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\r\n });\r\n }\r\n}\r\nabstract class CombineTexturesFrameBuffer extends SingleTextureFrameBuffer {\r\n constructor(textureAndFbo: TextureAndFbo, private _combineGeom: CachedGeometry, private _width: number, private _height: number, private _heightMult: number) { super(textureAndFbo); }\r\n public compose(target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n system.context.viewport(0, 0, this._width, this._heightMult * this._height);\r\n system.frameBufferStack.execute(this.fbo, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n target.techniques.draw(getDrawParams(target, this._combineGeom));\r\n });\r\n }\r\n}\r\n\r\nclass ClassifierCombinationBuffer extends CombineTexturesFrameBuffer {\r\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture): ClassifierAndMaskCombinationBuffer | undefined {\r\n const combineGeom = CombineTexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!);\r\n if (undefined === combineGeom)\r\n return undefined;\r\n\r\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 2 * height);\r\n return undefined === textureFbo ? undefined : new ClassifierCombinationBuffer(textureFbo, combineGeom, width, height, 2);\r\n }\r\n}\r\nclass ClassifierAndMaskCombinationBuffer extends CombineTexturesFrameBuffer {\r\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture, mask: Texture): ClassifierAndMaskCombinationBuffer | undefined {\r\n const combineGeom = Combine3TexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!, mask.texture.getHandle()!);\r\n if (undefined === combineGeom)\r\n return undefined;\r\n\r\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 3 * height);\r\n return undefined === textureFbo ? undefined : new ClassifierAndMaskCombinationBuffer(textureFbo, combineGeom, width, height, 3);\r\n }\r\n}\r\n\r\nconst scratchPrevRenderState = new RenderState();\r\n\r\n/** @internal */\r\nexport class PlanarClassifier extends RenderPlanarClassifier implements RenderMemory.Consumer, WebGLDisposable {\r\n private _classifierBuffers?: ClassifierFrameBuffers;\r\n private _maskBuffer?: MaskFrameBuffer;\r\n private _classifierCombinedBuffer?: ClassifierCombinationBuffer;\r\n private _classifierAndMaskCombinedBuffer?: ClassifierAndMaskCombinationBuffer;\r\n private _projectionMatrix = Matrix4d.createIdentity();\r\n private _graphics?: RenderGraphic[];\r\n private readonly _classifierGraphics: RenderGraphic[] = [];\r\n private readonly _maskGraphics: RenderGraphic[] = [];\r\n private _frustum?: Frustum;\r\n private _width = 0;\r\n private _height = 0;\r\n private _baseBatchId = 0;\r\n private _anyHilited = false;\r\n private _anyOpaque = false;\r\n private _anyTranslucent = false;\r\n private _classifier?: SpatialClassifier;\r\n private readonly _plane = Plane3dByOriginAndUnitNormal.create(new Point3d(0, 0, 0), new Vector3d(0, 0, 1))!; // TBD -- Support other planes - default to X-Y for now.\r\n private readonly _renderState = new RenderState();\r\n private readonly _renderCommands: RenderCommands;\r\n private readonly _branchStack = new BranchStack();\r\n private readonly _batchState: BatchState;\r\n private _planarClipMask?: PlanarClipMaskState;\r\n private _classifierTreeRef?: TileTreeReference;\r\n private _planarClipMaskOverrides?: FeatureSymbology.Overrides;\r\n private _contentMode: PlanarClassifierContent = PlanarClassifierContent.None;\r\n\r\n private static _postProjectionMatrix = Matrix4d.createRowValues(\r\n 0, 1, 0, 0,\r\n 0, 0, -1, 0,\r\n 1, 0, 0, 0,\r\n 0, 0, 0, 1);\r\n private _debugFrustum?: Frustum;\r\n private _doDebugFrustum = false;\r\n private _debugFrustumGraphic?: RenderGraphic = undefined;\r\n private _isClassifyingPointCloud?: boolean; // we will detect this the first time we draw\r\n private readonly _bgColor = ColorDef.from(0, 0, 0, 255);\r\n\r\n private constructor(classifier: SpatialClassifier | undefined, target: Target) {\r\n super();\r\n this._classifier = classifier;\r\n\r\n const flags = this._renderState.flags;\r\n flags.depthMask = flags.blend = flags.depthTest = false;\r\n\r\n this._batchState = new BatchState(this._branchStack);\r\n this._renderCommands = new RenderCommands(target, this._branchStack, this._batchState);\r\n }\r\n\r\n public getParams(params: Float32Array): void {\r\n params[0] = this.insideDisplay;\r\n params[1] = this.outsideDisplay;\r\n params[2] = this._contentMode;\r\n params[3] = (this._planarClipMask?.settings.transparency === undefined) ? -1 : this._planarClipMask.settings.transparency;\r\n }\r\n\r\n public get hiliteTexture(): Texture | undefined { return undefined !== this._classifierBuffers ? this._classifierBuffers.textures.hilite : undefined; }\r\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\r\n // public get properties(): SpatialClassifier { return this._classifier; }\r\n public get baseBatchId(): number { return this._baseBatchId; }\r\n public get anyHilited(): boolean { return this._anyHilited; }\r\n public get anyOpaque(): boolean { return this._anyOpaque; }\r\n public get anyTranslucent(): boolean { return this._anyTranslucent; }\r\n public get insideDisplay(): SpatialClassifierInsideDisplay { return this._classifier ? this._classifier.flags.inside : SpatialClassifierInsideDisplay.Off; }\r\n public get outsideDisplay(): SpatialClassifierOutsideDisplay { return this._classifier ? this._classifier.flags.outside : SpatialClassifierOutsideDisplay.On; }\r\n public get isClassifyingPointCloud(): boolean { return true === this._isClassifyingPointCloud; }\r\n\r\n public addGraphic(graphic: RenderGraphic) {\r\n this._graphics!.push(graphic);\r\n }\r\n\r\n public static create(properties: SpatialClassifier | undefined, target: Target): PlanarClassifier {\r\n return new PlanarClassifier(properties, target);\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n if (undefined !== this._classifierBuffers)\r\n this._classifierBuffers.textures.collectStatistics(stats);\r\n\r\n if (undefined !== this._maskBuffer)\r\n this._maskBuffer.collectStatistics(stats);\r\n\r\n if (undefined !== this._classifierCombinedBuffer)\r\n this._classifierCombinedBuffer.collectStatistics(stats);\r\n\r\n if (undefined !== this._classifierAndMaskCombinedBuffer)\r\n this._classifierAndMaskCombinedBuffer.collectStatistics(stats);\r\n }\r\n\r\n public get isDisposed(): boolean { return undefined === this._classifierBuffers; }\r\n\r\n public dispose() {\r\n this._classifierBuffers = dispose(this._classifierBuffers);\r\n this._maskBuffer = dispose(this._maskBuffer);\r\n this._classifierCombinedBuffer = dispose(this._classifierCombinedBuffer);\r\n this._classifierAndMaskCombinedBuffer = dispose(this._classifierAndMaskCombinedBuffer);\r\n }\r\n\r\n public get texture(): Texture | undefined {\r\n switch (this._contentMode) {\r\n case PlanarClassifierContent.None:\r\n return undefined;\r\n case PlanarClassifierContent.ClassifierOnly:\r\n return this._classifierCombinedBuffer?.texture;\r\n case PlanarClassifierContent.MaskOnly:\r\n return this._maskBuffer?.texture;\r\n case PlanarClassifierContent.ClassifierAndMask:\r\n return this._classifierAndMaskCombinedBuffer?.texture;\r\n }\r\n }\r\n\r\n private pushBatches(batchState: BatchState, graphics: RenderGraphic[]) {\r\n graphics.forEach((graphic) => {\r\n if (graphic instanceof Batch) {\r\n batchState.push(graphic, true);\r\n batchState.pop();\r\n } else if (graphic instanceof Branch) {\r\n this.pushBatches(batchState, graphic.branch.entries);\r\n }\r\n });\r\n }\r\n\r\n public pushBatchState(batchState: BatchState) {\r\n this._baseBatchId = batchState.nextBatchId - 1;\r\n if (undefined !== this._classifierGraphics)\r\n this.pushBatches(batchState, this._classifierGraphics);\r\n }\r\n\r\n public setSource(classifierTreeRef?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState) {\r\n this._classifierTreeRef = classifierTreeRef;\r\n this._classifier = classifierTreeRef?.activeClassifier;\r\n this._planarClipMask = planarClipMask;\r\n }\r\n\r\n public collectGraphics(context: SceneContext, target: PlanarClassifierTarget): void {\r\n this._classifierGraphics.length = this._maskGraphics.length = 0;\r\n if (undefined === context.viewingSpace)\r\n return;\r\n\r\n const viewState = context.viewingSpace.view as ViewState3d;\r\n if (undefined === viewState)\r\n return;\r\n\r\n // TBD - Refine resolution calculation -- increase height based on viewing angle.\r\n // But make sure that we don't make it larger than the hardware supports, keeping in mind that we will be doubling the height later.\r\n const requiredHeight = Math.min(Math.max(context.target.viewRect.width, context.target.viewRect.height), System.instance.capabilities.maxTextureSize / 2);\r\n const requiredWidth = requiredHeight;\r\n\r\n if (requiredWidth !== this._width || requiredHeight !== this._height)\r\n this.dispose();\r\n\r\n this._width = requiredWidth;\r\n this._height = requiredHeight;\r\n const maskTrees = this._planarClipMask?.getTileTrees(viewState, target.modelId);\r\n if (!maskTrees && !this._classifierTreeRef)\r\n return;\r\n\r\n const allTrees = maskTrees ? maskTrees.slice() : new Array<TileTreeReference>();\r\n if (this._classifierTreeRef)\r\n allTrees.push(this._classifierTreeRef);\r\n\r\n const projection = PlanarTextureProjection.computePlanarTextureProjection(this._plane, context, target, allTrees, viewState, this._width, this._height);\r\n if (!projection.textureFrustum || !projection.projectionMatrix || !projection.worldToViewMap)\r\n return;\r\n\r\n this._projectionMatrix = projection.projectionMatrix;\r\n this._frustum = projection.textureFrustum;\r\n this._debugFrustum = projection.debugFrustum;\r\n this._planarClipMaskOverrides = this._planarClipMask?.getPlanarClipMaskSymbologyOverrides();\r\n\r\n const drawTree = (treeRef: TileTreeReference, graphics: RenderGraphic[]) => {\r\n this._graphics = graphics;\r\n const drawArgs = GraphicsCollectorDrawArgs.create(context, this, treeRef, new FrustumPlanes(this._frustum), projection.worldToViewMap!);\r\n if (undefined !== drawArgs)\r\n treeRef.draw(drawArgs);\r\n\r\n this._graphics = undefined;\r\n };\r\n if (this._classifierTreeRef)\r\n drawTree(this._classifierTreeRef, this._classifierGraphics);\r\n\r\n if (maskTrees)\r\n maskTrees.forEach((maskTree) => drawTree(maskTree, this._maskGraphics));\r\n\r\n // Shader behaves slightly differently when classifying surfaces vs point clouds.\r\n this._isClassifyingPointCloud = target.isPointCloud;\r\n\r\n if (this._doDebugFrustum) {\r\n this._debugFrustumGraphic = dispose(this._debugFrustumGraphic);\r\n const builder = context.createSceneGraphicBuilder();\r\n\r\n builder.setSymbology(ColorDef.green, ColorDef.green, 1);\r\n builder.addFrustum(context.viewingSpace.getFrustum());\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 1);\r\n builder.addFrustum(this._debugFrustum!);\r\n builder.setSymbology(ColorDef.white, ColorDef.white, 1);\r\n builder.addFrustum(this._frustum);\r\n this._debugFrustumGraphic = builder.finish();\r\n }\r\n }\r\n\r\n public draw(target: Target) {\r\n if (undefined === this._frustum)\r\n return;\r\n\r\n this._contentMode = PlanarClassifierContent.None;\r\n let combinationBuffer: ClassifierCombinationBuffer | undefined;\r\n if (this._classifierGraphics.length === 0) {\r\n if (this._maskGraphics.length === 0) {\r\n return;\r\n } else {\r\n if (undefined === this._maskBuffer) {\r\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\r\n if (undefined === this._maskBuffer)\r\n return;\r\n }\r\n this._contentMode = PlanarClassifierContent.MaskOnly;\r\n }\r\n } else {\r\n if (undefined === this._classifierBuffers) {\r\n this._classifierBuffers = ClassifierFrameBuffers.create(this._width, this._height);\r\n if (undefined === this._classifierBuffers)\r\n return;\r\n }\r\n if (this._maskGraphics.length === 0) {\r\n if (undefined === this._classifierCombinedBuffer) {\r\n combinationBuffer = this._classifierCombinedBuffer = ClassifierCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature);\r\n if (undefined === this._classifierCombinedBuffer)\r\n return;\r\n }\r\n this._contentMode = PlanarClassifierContent.ClassifierOnly;\r\n combinationBuffer = this._classifierCombinedBuffer;\r\n } else {\r\n if (undefined === this._maskBuffer) {\r\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\r\n if (undefined === this._maskBuffer)\r\n return;\r\n }\r\n if (undefined === this._classifierAndMaskCombinedBuffer) {\r\n combinationBuffer = this._classifierAndMaskCombinedBuffer = ClassifierAndMaskCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature, this._maskBuffer.texture);\r\n if (undefined === this._classifierAndMaskCombinedBuffer)\r\n return;\r\n }\r\n combinationBuffer = this._classifierAndMaskCombinedBuffer;\r\n this._contentMode = PlanarClassifierContent.ClassifierAndMask;\r\n }\r\n }\r\n\r\n if (undefined !== this._debugFrustumGraphic)\r\n target.graphics.foreground.push(this._debugFrustumGraphic);\r\n\r\n // Temporarily override the Target's state.\r\n const system = System.instance;\r\n const prevState = system.currentRenderState.clone(scratchPrevRenderState);\r\n system.context.viewport(0, 0, this._width, this._height);\r\n\r\n const vf = target.currentViewFlags.copy({\r\n renderMode: RenderMode.SmoothShade,\r\n transparency: !this.isClassifyingPointCloud, // point clouds don't support transparency.\r\n textures: false,\r\n lighting: false,\r\n shadows: false,\r\n monochrome: false,\r\n materials: false,\r\n ambientOcclusion: false,\r\n visibleEdges: false,\r\n hiddenEdges: false,\r\n });\r\n\r\n system.applyRenderState(this._renderState);\r\n const prevPlan = target.plan;\r\n const prevOverrides = target.currentFeatureSymbologyOverrides;\r\n\r\n target.uniforms.style.changeBackgroundColor(this._bgColor); // Avoid white on white reversal. Will be reset in changeRenderPlan below.\r\n target.changeFrustum(this._frustum, this._frustum.getFraction(), true);\r\n this._anyTranslucent = false;\r\n\r\n const prevProjMatrix = target.uniforms.frustum.projectionMatrix;\r\n target.uniforms.frustum.changeProjectionMatrix(PlanarClassifier._postProjectionMatrix.multiplyMatrixMatrix(prevProjMatrix));\r\n target.uniforms.branch.changeRenderPlan(vf, target.plan.is3d, target.plan.hline);\r\n\r\n const renderCommands = this._renderCommands;\r\n const getDrawCommands = (graphics: RenderGraphic[]) => {\r\n this._batchState.reset();\r\n renderCommands.reset(target, this._branchStack, this._batchState);\r\n renderCommands.collectGraphicsForPlanarProjection(graphics);\r\n\r\n // Draw the classifiers into our attachments.\r\n // When using Display.ElementColor, the color and transparency come from the classifier geometry. Therefore we may need to draw the classified geometry\r\n // in a different pass - or both passes - depending on the transparency of the classifiers.\r\n // NB: \"Outside\" geometry by definition cannot take color/transparency from element...\r\n const cmds = renderCommands.getCommands(RenderPass.OpaquePlanar);\r\n\r\n // NB: We don't strictly require the classifier geometry to be planar, and sometimes (e.g., \"planar\" polyface/bspsurf) we do not detect planarity.\r\n cmds.push(...renderCommands.getCommands(RenderPass.OpaqueGeneral));\r\n this._anyOpaque = cmds.length > 0;\r\n const transCmds = renderCommands.getCommands(RenderPass.Translucent);\r\n if (transCmds.length > 0) {\r\n cmds.push(...transCmds);\r\n this._anyTranslucent = true;\r\n }\r\n return cmds;\r\n };\r\n\r\n if (this._classifierGraphics.length > 0 && this._classifierBuffers) {\r\n this._classifierBuffers.draw(getDrawCommands(this._classifierGraphics), target);\r\n\r\n // Draw any hilited classifiers.\r\n const hiliteCommands = renderCommands.getCommands(RenderPass.Hilite);\r\n this._anyHilited = 0 !== hiliteCommands.length;\r\n if (this._anyHilited)\r\n this._classifierBuffers.drawHilite(hiliteCommands, target);\r\n }\r\n if (this._maskGraphics.length > 0 && this._maskBuffer) {\r\n if (this._planarClipMaskOverrides)\r\n target.overrideFeatureSymbology(this._planarClipMaskOverrides);\r\n if (this._planarClipMask && this._planarClipMask.settings.transparency !== undefined && this._planarClipMask.settings.transparency > 0.0)\r\n this._anyTranslucent = true;\r\n\r\n this._maskBuffer.draw(getDrawCommands(this._maskGraphics), target);\r\n\r\n }\r\n if (combinationBuffer)\r\n combinationBuffer.compose(target);\r\n\r\n this._batchState.reset();\r\n target.changeRenderPlan(prevPlan);\r\n target.overrideFeatureSymbology(prevOverrides);\r\n\r\n system.applyRenderState(prevState);\r\n system.context.viewport(0, 0, target.viewRect.width, target.viewRect.height);\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"PlanarClassifier.js","sourceRoot":"","sources":["../../../../src/render/webgl/PlanarClassifier.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,4BAA4B,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,QAAQ,EAAW,aAAa,EAAE,UAAU,EAAE,aAAa,EAAqB,8BAA8B,EAAE,+BAA+B,GAChJ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,yBAAyB,EAAyD,MAAM,qBAAqB,CAAC;AAMvH,OAAO,EAA0B,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAkB,wBAAwB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG3H,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC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AAwB,CAAC,CAAC;YACjE,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,GAAG,GAAG;gBACtI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAE9B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC;SAEpE;QACD,IAAI,iBAAiB;YACnB,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAE/C,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;;AApTc,sCAAqB,GAAG,QAAQ,CAAC,eAAe,CAC7D,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EACX,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module WebGL\r\n */\r\n\r\nimport { dispose } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Plane3dByOriginAndUnitNormal, Point3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport {\r\n ColorDef, Frustum, FrustumPlanes, RenderMode, RenderTexture, SpatialClassifier, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay,\r\n} from \"@itwin/core-common\";\r\nimport { PlanarClipMaskState } from \"../../PlanarClipMaskState\";\r\nimport { GraphicsCollectorDrawArgs, SpatialClassifierTileTreeReference, TileTreeReference } from \"../../tile/internal\";\r\nimport { SceneContext } from \"../../ViewContext\";\r\nimport { ViewState3d } from \"../../ViewState\";\r\nimport { FeatureSymbology } from \"../FeatureSymbology\";\r\nimport { RenderGraphic } from \"../RenderGraphic\";\r\nimport { RenderMemory } from \"../RenderMemory\";\r\nimport { PlanarClassifierTarget, RenderPlanarClassifier } from \"../RenderPlanarClassifier\";\r\nimport { BatchState } from \"./BatchState\";\r\nimport { BranchStack } from \"./BranchStack\";\r\nimport { CachedGeometry, Combine3TexturesGeometry, CombineTexturesGeometry, ViewportQuadGeometry } from \"./CachedGeometry\";\r\nimport { WebGLDisposable } from \"./Disposable\";\r\nimport { DrawCommands } from \"./DrawCommand\";\r\nimport { FrameBuffer } from \"./FrameBuffer\";\r\nimport { GL } from \"./GL\";\r\nimport { Batch, Branch } from \"./Graphic\";\r\nimport { PlanarTextureProjection } from \"./PlanarTextureProjection\";\r\nimport { RenderCommands } from \"./RenderCommands\";\r\nimport { RenderPass } from \"./RenderFlags\";\r\nimport { RenderState } from \"./RenderState\";\r\nimport { getDrawParams } from \"./ScratchDrawParams\";\r\nimport { System } from \"./System\";\r\nimport { Target } from \"./Target\";\r\nimport { TechniqueId } from \"./TechniqueId\";\r\nimport { Texture, TextureHandle } from \"./Texture\";\r\n\r\nexport enum PlanarClassifierContent { None = 0, MaskOnly = 1, ClassifierOnly = 2, ClassifierAndMask = 3 }\r\n\r\nfunction createTexture(handle: TextureHandle): Texture {\r\n return new Texture({\r\n handle,\r\n ownership: \"external\",\r\n type: RenderTexture.Type.TileSection,\r\n });\r\n}\r\n\r\nfunction createTextureHandle(width: number, height: number, heightMult = 1.0) { return TextureHandle.createForAttachment(width, height * heightMult, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte); }\r\n\r\nclass ClassifierTextures implements WebGLDisposable {\r\n private constructor(public readonly color: Texture,\r\n public readonly feature: Texture,\r\n public readonly hilite: Texture) { }\r\n\r\n public get isDisposed(): boolean {\r\n return this.color.isDisposed\r\n && this.feature.isDisposed\r\n && this.hilite.isDisposed;\r\n }\r\n\r\n public dispose(): void {\r\n dispose(this.color);\r\n dispose(this.feature);\r\n dispose(this.hilite);\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n stats.addPlanarClassifier(this.color.bytesUsed);\r\n stats.addPlanarClassifier(this.feature.bytesUsed);\r\n stats.addPlanarClassifier(this.hilite.bytesUsed);\r\n }\r\n\r\n public static create(width: number, height: number): ClassifierTextures | undefined {\r\n const hColor = createTextureHandle(width, height);\r\n const hFeature = createTextureHandle(width, height);\r\n const hHilite = createTextureHandle(width, height);\r\n if (!hColor || !hFeature || !hHilite)\r\n return undefined;\r\n\r\n const color = createTexture(hColor);\r\n const feature = createTexture(hFeature);\r\n const hilite = createTexture(hHilite);\r\n if (!color || !feature || !hilite)\r\n return undefined;\r\n\r\n return new ClassifierTextures(color, feature, hilite);\r\n }\r\n}\r\n\r\nabstract class ClassifierFrameBuffers implements WebGLDisposable {\r\n protected constructor(\r\n public readonly textures: ClassifierTextures,\r\n private readonly _hilite: FrameBuffer) { }\r\n\r\n public get isDisposed(): boolean {\r\n return this.textures.isDisposed && this._hilite.isDisposed;\r\n }\r\n\r\n public dispose(): void {\r\n dispose(this.textures);\r\n dispose(this._hilite);\r\n }\r\n\r\n public abstract draw(cmds: DrawCommands, target: Target): void;\r\n\r\n public drawHilite(cmds: DrawCommands, target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n system.frameBufferStack.execute(this._hilite, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n target.techniques.execute(target, cmds, RenderPass.Hilite);\r\n });\r\n }\r\n\r\n public static create(width: number, height: number): ClassifierFrameBuffers | undefined {\r\n const textures = ClassifierTextures.create(width, height);\r\n if (undefined === textures)\r\n return undefined;\r\n\r\n const hiliteFbo = FrameBuffer.create([textures.hilite.texture]);\r\n if (undefined === hiliteFbo)\r\n return undefined;\r\n\r\n if (System.instance.capabilities.supportsDrawBuffers)\r\n return ClassifierMRTFrameBuffers.createMRT(textures, hiliteFbo);\r\n else\r\n return ClassifierMPFrameBuffers.createMP(textures, hiliteFbo);\r\n }\r\n}\r\n\r\nclass ClassifierMRTFrameBuffers extends ClassifierFrameBuffers {\r\n private readonly _fbo: FrameBuffer;\r\n private readonly _clearGeom: ViewportQuadGeometry;\r\n\r\n private constructor(textures: ClassifierTextures, hilite: FrameBuffer, fbo: FrameBuffer, geom: ViewportQuadGeometry) {\r\n super(textures, hilite);\r\n this._fbo = fbo;\r\n this._clearGeom = geom;\r\n }\r\n\r\n public override get isDisposed(): boolean {\r\n return super.isDisposed\r\n && this._fbo.isDisposed\r\n && this._clearGeom.isDisposed;\r\n }\r\n\r\n public override dispose(): void {\r\n dispose(this._fbo);\r\n dispose(this._clearGeom);\r\n super.dispose();\r\n }\r\n\r\n public static createMRT(textures: ClassifierTextures, hilite: FrameBuffer): ClassifierMRTFrameBuffers | undefined {\r\n const fbo = FrameBuffer.create([textures.color.texture, textures.feature.texture]);\r\n if (undefined === fbo)\r\n return undefined;\r\n\r\n const geom = ViewportQuadGeometry.create(TechniqueId.ClearPickAndColor);\r\n return undefined !== geom ? new ClassifierMRTFrameBuffers(textures, hilite, fbo, geom) : undefined;\r\n }\r\n\r\n public draw(cmds: DrawCommands, target: Target): void {\r\n System.instance.frameBufferStack.execute(this._fbo, true, false, () => {\r\n target.techniques.draw(getDrawParams(target, this._clearGeom));\r\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\r\n });\r\n }\r\n}\r\n\r\nclass ClassifierMPFrameBuffers extends ClassifierFrameBuffers {\r\n private readonly _color: FrameBuffer;\r\n private readonly _feature: FrameBuffer;\r\n\r\n private constructor(textures: ClassifierTextures, hilite: FrameBuffer, color: FrameBuffer, feature: FrameBuffer) {\r\n super(textures, hilite);\r\n this._color = color;\r\n this._feature = feature;\r\n }\r\n\r\n public override get isDisposed(): boolean {\r\n return super.isDisposed\r\n && this._color.isDisposed\r\n && this._feature.isDisposed;\r\n }\r\n\r\n public override dispose(): void {\r\n dispose(this._color);\r\n dispose(this._feature);\r\n super.dispose();\r\n }\r\n\r\n public static createMP(textures: ClassifierTextures, hilite: FrameBuffer): ClassifierMPFrameBuffers | undefined {\r\n const color = FrameBuffer.create([textures.color.texture]);\r\n const feature = FrameBuffer.create([textures.feature.texture]);\r\n return undefined !== color && undefined !== feature ? new ClassifierMPFrameBuffers(textures, hilite, color, feature) : undefined;\r\n }\r\n\r\n public draw(cmds: DrawCommands, target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n const draw = (feature: boolean) => {\r\n const fbo = feature ? this._feature : this._color;\r\n system.frameBufferStack.execute(fbo, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n target.compositor.currentRenderTargetIndex = feature ? 1 : 0;\r\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\r\n });\r\n };\r\n\r\n draw(false);\r\n draw(true);\r\n }\r\n}\r\n\r\ninterface TextureAndFbo {\r\n texture: Texture;\r\n fbo: FrameBuffer;\r\n}\r\n\r\nabstract class SingleTextureFrameBuffer implements WebGLDisposable {\r\n public texture: Texture;\r\n protected fbo: FrameBuffer;\r\n public get isDisposed(): boolean { return this.texture.isDisposed && this.fbo.isDisposed; }\r\n public collectStatistics(stats: RenderMemory.Statistics): void { stats.addPlanarClassifier(this.texture.bytesUsed); }\r\n protected constructor(textureAndFbo: TextureAndFbo) {\r\n this.texture = textureAndFbo.texture;\r\n this.fbo = textureAndFbo.fbo;\r\n }\r\n public dispose(): void {\r\n dispose(this.texture);\r\n dispose(this.fbo);\r\n }\r\n public static createTextureAndFrameBuffer(width: number, height: number): TextureAndFbo | undefined {\r\n const hTexture = TextureHandle.createForAttachment(width, height, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\r\n if (!hTexture)\r\n return undefined;\r\n\r\n const texture = new Texture({ type: RenderTexture.Type.TileSection, ownership: \"external\", handle: hTexture });\r\n if (!texture)\r\n return undefined;\r\n\r\n const fbo = FrameBuffer.create([texture.texture]);\r\n if (undefined === fbo)\r\n return undefined;\r\n\r\n return { texture, fbo };\r\n }\r\n}\r\nclass MaskFrameBuffer extends SingleTextureFrameBuffer {\r\n public static create(width: number, height: number): MaskFrameBuffer | undefined {\r\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, height);\r\n return undefined === textureFbo ? undefined : new MaskFrameBuffer(textureFbo);\r\n }\r\n public draw(cmds: DrawCommands, target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n\r\n system.frameBufferStack.execute(this.fbo, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n if (!System.instance.capabilities.supportsDrawBuffers)\r\n target.compositor.currentRenderTargetIndex = 0;\r\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\r\n });\r\n }\r\n}\r\nabstract class CombineTexturesFrameBuffer extends SingleTextureFrameBuffer {\r\n constructor(textureAndFbo: TextureAndFbo, private _combineGeom: CachedGeometry, private _width: number, private _height: number, private _heightMult: number) { super(textureAndFbo); }\r\n public compose(target: Target): void {\r\n const system = System.instance;\r\n const gl = system.context;\r\n system.context.viewport(0, 0, this._width, this._heightMult * this._height);\r\n system.frameBufferStack.execute(this.fbo, true, false, () => {\r\n gl.clearColor(0, 0, 0, 0);\r\n gl.clear(GL.BufferBit.Color);\r\n target.techniques.draw(getDrawParams(target, this._combineGeom));\r\n });\r\n }\r\n}\r\n\r\nclass ClassifierCombinationBuffer extends CombineTexturesFrameBuffer {\r\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture): ClassifierAndMaskCombinationBuffer | undefined {\r\n const combineGeom = CombineTexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!);\r\n if (undefined === combineGeom)\r\n return undefined;\r\n\r\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 2 * height);\r\n return undefined === textureFbo ? undefined : new ClassifierCombinationBuffer(textureFbo, combineGeom, width, height, 2);\r\n }\r\n}\r\nclass ClassifierAndMaskCombinationBuffer extends CombineTexturesFrameBuffer {\r\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture, mask: Texture): ClassifierAndMaskCombinationBuffer | undefined {\r\n const combineGeom = Combine3TexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!, mask.texture.getHandle()!);\r\n if (undefined === combineGeom)\r\n return undefined;\r\n\r\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 3 * height);\r\n return undefined === textureFbo ? undefined : new ClassifierAndMaskCombinationBuffer(textureFbo, combineGeom, width, height, 3);\r\n }\r\n}\r\n\r\nconst scratchPrevRenderState = new RenderState();\r\n\r\n/** @internal */\r\nexport class PlanarClassifier extends RenderPlanarClassifier implements RenderMemory.Consumer, WebGLDisposable {\r\n private _classifierBuffers?: ClassifierFrameBuffers;\r\n private _maskBuffer?: MaskFrameBuffer;\r\n private _classifierCombinedBuffer?: ClassifierCombinationBuffer;\r\n private _classifierAndMaskCombinedBuffer?: ClassifierAndMaskCombinationBuffer;\r\n private _projectionMatrix = Matrix4d.createIdentity();\r\n private _graphics?: RenderGraphic[];\r\n private readonly _classifierGraphics: RenderGraphic[] = [];\r\n private readonly _maskGraphics: RenderGraphic[] = [];\r\n private _frustum?: Frustum;\r\n private _width = 0;\r\n private _height = 0;\r\n private _baseBatchId = 0;\r\n private _anyHilited = false;\r\n private _anyOpaque = false;\r\n private _anyTranslucent = false;\r\n private _classifier?: SpatialClassifier;\r\n private readonly _plane = Plane3dByOriginAndUnitNormal.create(new Point3d(0, 0, 0), new Vector3d(0, 0, 1))!; // TBD -- Support other planes - default to X-Y for now.\r\n private readonly _renderState = new RenderState();\r\n private readonly _renderCommands: RenderCommands;\r\n private readonly _branchStack = new BranchStack();\r\n private readonly _batchState: BatchState;\r\n private _planarClipMask?: PlanarClipMaskState;\r\n private _classifierTreeRef?: TileTreeReference;\r\n private _planarClipMaskOverrides?: FeatureSymbology.Overrides;\r\n private _contentMode: PlanarClassifierContent = PlanarClassifierContent.None;\r\n\r\n private static _postProjectionMatrix = Matrix4d.createRowValues(\r\n 0, 1, 0, 0,\r\n 0, 0, -1, 0,\r\n 1, 0, 0, 0,\r\n 0, 0, 0, 1);\r\n private _debugFrustum?: Frustum;\r\n private _doDebugFrustum = false;\r\n private _debugFrustumGraphic?: RenderGraphic = undefined;\r\n private _isClassifyingPointCloud?: boolean; // we will detect this the first time we draw\r\n private readonly _bgColor = ColorDef.from(0, 0, 0, 255);\r\n\r\n private constructor(classifier: SpatialClassifier | undefined, target: Target) {\r\n super();\r\n this._classifier = classifier;\r\n\r\n const flags = this._renderState.flags;\r\n flags.depthMask = flags.blend = flags.depthTest = false;\r\n\r\n this._batchState = new BatchState(this._branchStack);\r\n this._renderCommands = new RenderCommands(target, this._branchStack, this._batchState);\r\n }\r\n\r\n public getParams(params: Float32Array): void {\r\n params[0] = this.insideDisplay;\r\n params[1] = this.outsideDisplay;\r\n params[2] = this._contentMode;\r\n if (this._planarClipMask?.settings.invert) // If the mask sense is inverted, negate the contentMode to indicate this to the shader.\r\n params[2] = - params[2];\r\n\r\n params[3] = (this._planarClipMask?.settings.transparency === undefined) ? -1 : this._planarClipMask.settings.transparency;\r\n\r\n }\r\n\r\n public get hiliteTexture(): Texture | undefined { return undefined !== this._classifierBuffers ? this._classifierBuffers.textures.hilite : undefined; }\r\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\r\n // public get properties(): SpatialClassifier { return this._classifier; }\r\n public get baseBatchId(): number { return this._baseBatchId; }\r\n public get anyHilited(): boolean { return this._anyHilited; }\r\n public get anyOpaque(): boolean { return this._anyOpaque; }\r\n public get anyTranslucent(): boolean { return this._anyTranslucent; }\r\n public get insideDisplay(): SpatialClassifierInsideDisplay { return this._classifier ? this._classifier.flags.inside : SpatialClassifierInsideDisplay.Off; }\r\n public get outsideDisplay(): SpatialClassifierOutsideDisplay { return this._classifier ? this._classifier.flags.outside : SpatialClassifierOutsideDisplay.On; }\r\n public get isClassifyingPointCloud(): boolean { return true === this._isClassifyingPointCloud; }\r\n\r\n public addGraphic(graphic: RenderGraphic) {\r\n this._graphics!.push(graphic);\r\n }\r\n\r\n public static create(properties: SpatialClassifier | undefined, target: Target): PlanarClassifier {\r\n return new PlanarClassifier(properties, target);\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n if (undefined !== this._classifierBuffers)\r\n this._classifierBuffers.textures.collectStatistics(stats);\r\n\r\n if (undefined !== this._maskBuffer)\r\n this._maskBuffer.collectStatistics(stats);\r\n\r\n if (undefined !== this._classifierCombinedBuffer)\r\n this._classifierCombinedBuffer.collectStatistics(stats);\r\n\r\n if (undefined !== this._classifierAndMaskCombinedBuffer)\r\n this._classifierAndMaskCombinedBuffer.collectStatistics(stats);\r\n }\r\n\r\n public get isDisposed(): boolean { return undefined === this._classifierBuffers; }\r\n\r\n public dispose() {\r\n this._classifierBuffers = dispose(this._classifierBuffers);\r\n this._maskBuffer = dispose(this._maskBuffer);\r\n this._classifierCombinedBuffer = dispose(this._classifierCombinedBuffer);\r\n this._classifierAndMaskCombinedBuffer = dispose(this._classifierAndMaskCombinedBuffer);\r\n }\r\n\r\n public get texture(): Texture | undefined {\r\n switch (this._contentMode) {\r\n case PlanarClassifierContent.None:\r\n return undefined;\r\n case PlanarClassifierContent.ClassifierOnly:\r\n return this._classifierCombinedBuffer?.texture;\r\n case PlanarClassifierContent.MaskOnly:\r\n return this._maskBuffer?.texture;\r\n case PlanarClassifierContent.ClassifierAndMask:\r\n return this._classifierAndMaskCombinedBuffer?.texture;\r\n }\r\n }\r\n\r\n private pushBatches(batchState: BatchState, graphics: RenderGraphic[]) {\r\n graphics.forEach((graphic) => {\r\n if (graphic instanceof Batch) {\r\n batchState.push(graphic, true);\r\n batchState.pop();\r\n } else if (graphic instanceof Branch) {\r\n this.pushBatches(batchState, graphic.branch.entries);\r\n }\r\n });\r\n }\r\n\r\n public pushBatchState(batchState: BatchState) {\r\n this._baseBatchId = batchState.nextBatchId - 1;\r\n if (undefined !== this._classifierGraphics)\r\n this.pushBatches(batchState, this._classifierGraphics);\r\n }\r\n\r\n public setSource(classifierTreeRef?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState) {\r\n this._classifierTreeRef = classifierTreeRef;\r\n this._classifier = classifierTreeRef?.activeClassifier;\r\n this._planarClipMask = planarClipMask;\r\n }\r\n\r\n public collectGraphics(context: SceneContext, target: PlanarClassifierTarget): void {\r\n this._classifierGraphics.length = this._maskGraphics.length = 0;\r\n if (undefined === context.viewingSpace)\r\n return;\r\n\r\n const viewState = context.viewingSpace.view as ViewState3d;\r\n if (undefined === viewState)\r\n return;\r\n\r\n // TBD - Refine resolution calculation -- increase height based on viewing angle.\r\n // But make sure that we don't make it larger than the hardware supports, keeping in mind that we will be doubling the height later.\r\n const requiredHeight = Math.min(Math.max(context.target.viewRect.width, context.target.viewRect.height), System.instance.capabilities.maxTextureSize / 2);\r\n const requiredWidth = requiredHeight;\r\n\r\n if (requiredWidth !== this._width || requiredHeight !== this._height)\r\n this.dispose();\r\n\r\n this._width = requiredWidth;\r\n this._height = requiredHeight;\r\n const maskTrees = this._planarClipMask?.getTileTrees(viewState, target.modelId);\r\n if (!maskTrees && !this._classifierTreeRef)\r\n return;\r\n\r\n const allTrees = maskTrees ? maskTrees.slice() : new Array<TileTreeReference>();\r\n if (this._classifierTreeRef)\r\n allTrees.push(this._classifierTreeRef);\r\n\r\n const projection = PlanarTextureProjection.computePlanarTextureProjection(this._plane, context, target, allTrees, viewState, this._width, this._height);\r\n if (!projection.textureFrustum || !projection.projectionMatrix || !projection.worldToViewMap)\r\n return;\r\n\r\n this._projectionMatrix = projection.projectionMatrix;\r\n this._frustum = projection.textureFrustum;\r\n this._debugFrustum = projection.debugFrustum;\r\n this._planarClipMaskOverrides = this._planarClipMask?.getPlanarClipMaskSymbologyOverrides();\r\n\r\n const drawTree = (treeRef: TileTreeReference, graphics: RenderGraphic[]) => {\r\n this._graphics = graphics;\r\n const drawArgs = GraphicsCollectorDrawArgs.create(context, this, treeRef, new FrustumPlanes(this._frustum), projection.worldToViewMap!);\r\n if (undefined !== drawArgs)\r\n treeRef.draw(drawArgs);\r\n\r\n this._graphics = undefined;\r\n };\r\n if (this._classifierTreeRef)\r\n drawTree(this._classifierTreeRef, this._classifierGraphics);\r\n\r\n if (maskTrees)\r\n maskTrees.forEach((maskTree) => drawTree(maskTree, this._maskGraphics));\r\n\r\n // Shader behaves slightly differently when classifying surfaces vs point clouds.\r\n this._isClassifyingPointCloud = target.isPointCloud;\r\n\r\n if (this._doDebugFrustum) {\r\n this._debugFrustumGraphic = dispose(this._debugFrustumGraphic);\r\n const builder = context.createSceneGraphicBuilder();\r\n\r\n builder.setSymbology(ColorDef.green, ColorDef.green, 1);\r\n builder.addFrustum(context.viewingSpace.getFrustum());\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 1);\r\n builder.addFrustum(this._debugFrustum!);\r\n builder.setSymbology(ColorDef.white, ColorDef.white, 1);\r\n builder.addFrustum(this._frustum);\r\n this._debugFrustumGraphic = builder.finish();\r\n }\r\n }\r\n\r\n public draw(target: Target) {\r\n if (undefined === this._frustum)\r\n return;\r\n\r\n this._contentMode = PlanarClassifierContent.None;\r\n let combinationBuffer: ClassifierCombinationBuffer | undefined;\r\n if (this._classifierGraphics.length === 0) {\r\n if (this._maskGraphics.length === 0) {\r\n return;\r\n } else {\r\n if (undefined === this._maskBuffer) {\r\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\r\n if (undefined === this._maskBuffer)\r\n return;\r\n }\r\n this._contentMode = PlanarClassifierContent.MaskOnly;\r\n }\r\n } else {\r\n if (undefined === this._classifierBuffers) {\r\n this._classifierBuffers = ClassifierFrameBuffers.create(this._width, this._height);\r\n if (undefined === this._classifierBuffers)\r\n return;\r\n }\r\n if (this._maskGraphics.length === 0) {\r\n if (undefined === this._classifierCombinedBuffer) {\r\n combinationBuffer = this._classifierCombinedBuffer = ClassifierCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature);\r\n if (undefined === this._classifierCombinedBuffer)\r\n return;\r\n }\r\n this._contentMode = PlanarClassifierContent.ClassifierOnly;\r\n combinationBuffer = this._classifierCombinedBuffer;\r\n } else {\r\n if (undefined === this._maskBuffer) {\r\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\r\n if (undefined === this._maskBuffer)\r\n return;\r\n }\r\n if (undefined === this._classifierAndMaskCombinedBuffer) {\r\n combinationBuffer = this._classifierAndMaskCombinedBuffer = ClassifierAndMaskCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature, this._maskBuffer.texture);\r\n if (undefined === this._classifierAndMaskCombinedBuffer)\r\n return;\r\n }\r\n combinationBuffer = this._classifierAndMaskCombinedBuffer;\r\n this._contentMode = PlanarClassifierContent.ClassifierAndMask;\r\n }\r\n }\r\n\r\n if (undefined !== this._debugFrustumGraphic)\r\n target.graphics.foreground.push(this._debugFrustumGraphic);\r\n\r\n // Temporarily override the Target's state.\r\n const system = System.instance;\r\n const prevState = system.currentRenderState.clone(scratchPrevRenderState);\r\n system.context.viewport(0, 0, this._width, this._height);\r\n\r\n const vf = target.currentViewFlags.copy({\r\n renderMode: RenderMode.SmoothShade,\r\n transparency: !this.isClassifyingPointCloud, // point clouds don't support transparency.\r\n textures: false,\r\n lighting: false,\r\n shadows: false,\r\n monochrome: false,\r\n materials: false,\r\n ambientOcclusion: false,\r\n visibleEdges: false,\r\n hiddenEdges: false,\r\n });\r\n\r\n system.applyRenderState(this._renderState);\r\n const prevPlan = target.plan;\r\n const prevOverrides = target.currentFeatureSymbologyOverrides;\r\n\r\n target.uniforms.style.changeBackgroundColor(this._bgColor); // Avoid white on white reversal. Will be reset in changeRenderPlan below.\r\n target.changeFrustum(this._frustum, this._frustum.getFraction(), true);\r\n this._anyTranslucent = false;\r\n\r\n const prevProjMatrix = target.uniforms.frustum.projectionMatrix;\r\n target.uniforms.frustum.changeProjectionMatrix(PlanarClassifier._postProjectionMatrix.multiplyMatrixMatrix(prevProjMatrix));\r\n target.uniforms.branch.changeRenderPlan(vf, target.plan.is3d, target.plan.hline);\r\n\r\n const renderCommands = this._renderCommands;\r\n const getDrawCommands = (graphics: RenderGraphic[]) => {\r\n this._batchState.reset();\r\n renderCommands.reset(target, this._branchStack, this._batchState);\r\n renderCommands.collectGraphicsForPlanarProjection(graphics);\r\n\r\n // Draw the classifiers into our attachments.\r\n // When using Display.ElementColor, the color and transparency come from the classifier geometry. Therefore we may need to draw the classified geometry\r\n // in a different pass - or both passes - depending on the transparency of the classifiers.\r\n // NB: \"Outside\" geometry by definition cannot take color/transparency from element...\r\n const cmds = renderCommands.getCommands(RenderPass.OpaquePlanar);\r\n\r\n // NB: We don't strictly require the classifier geometry to be planar, and sometimes (e.g., \"planar\" polyface/bspsurf) we do not detect planarity.\r\n cmds.push(...renderCommands.getCommands(RenderPass.OpaqueGeneral));\r\n this._anyOpaque = cmds.length > 0;\r\n const transCmds = renderCommands.getCommands(RenderPass.Translucent);\r\n if (transCmds.length > 0) {\r\n cmds.push(...transCmds);\r\n this._anyTranslucent = true;\r\n }\r\n return cmds;\r\n };\r\n\r\n if (this._classifierGraphics.length > 0 && this._classifierBuffers) {\r\n this._classifierBuffers.draw(getDrawCommands(this._classifierGraphics), target);\r\n\r\n // Draw any hilited classifiers.\r\n const hiliteCommands = renderCommands.getCommands(RenderPass.Hilite);\r\n this._anyHilited = 0 !== hiliteCommands.length;\r\n if (this._anyHilited)\r\n this._classifierBuffers.drawHilite(hiliteCommands, target);\r\n }\r\n if (this._maskGraphics.length > 0 && this._maskBuffer) {\r\n if (this._planarClipMaskOverrides)\r\n target.overrideFeatureSymbology(this._planarClipMaskOverrides);\r\n if (this._planarClipMask && this._planarClipMask.settings.transparency !== undefined && this._planarClipMask.settings.transparency > 0.0)\r\n this._anyTranslucent = true;\r\n\r\n this._maskBuffer.draw(getDrawCommands(this._maskGraphics), target);\r\n\r\n }\r\n if (combinationBuffer)\r\n combinationBuffer.compose(target);\r\n\r\n this._batchState.reset();\r\n target.changeRenderPlan(prevPlan);\r\n target.overrideFeatureSymbology(prevOverrides);\r\n\r\n system.applyRenderState(prevState);\r\n system.context.viewport(0, 0, target.viewRect.width, target.viewRect.height);\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarClassification.d.ts","sourceRoot":"","sources":["../../../../../src/render/webgl/glsl/PlanarClassification.ts"],"names":[],"mappings":"AAeA,OAAO,EAA2B,cAAc,EAA+B,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAO/C,eAAO,MAAM,mBAAmB,qMAM/B,CAAC;
|
|
1
|
+
{"version":3,"file":"PlanarClassification.d.ts","sourceRoot":"","sources":["../../../../../src/render/webgl/glsl/PlanarClassification.ts"],"names":[],"mappings":"AAeA,OAAO,EAA2B,cAAc,EAA+B,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAO/C,eAAO,MAAM,mBAAmB,qMAM/B,CAAC;AAmNF,gBAAgB;AAChB,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,QAyD7G;AAED,gBAAgB;AAChB,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,cAAc,QAiBjE;AAED,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,cAAc,EAAE,eAAe,UAAO,QAYxF;AAkED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAgBhG"}
|
|
@@ -44,6 +44,12 @@ if (u_pClassColorParams.x > kClassifierDisplay_Element) { // texture/terrain dra
|
|
|
44
44
|
return vec4(rgb, baseColor.a);
|
|
45
45
|
}
|
|
46
46
|
float imageCount = u_pClassColorParams.z;
|
|
47
|
+
// If imageCount is less than zero - the mask sense is inverted - inside rather than outside. (masks only)
|
|
48
|
+
bool doInvert = false;
|
|
49
|
+
if (imageCount < 0.0) {
|
|
50
|
+
imageCount = - imageCount;
|
|
51
|
+
doInvert = true;
|
|
52
|
+
}
|
|
47
53
|
|
|
48
54
|
vec4 colorTexel = vec4(0);
|
|
49
55
|
vec4 maskTexel = vec4(0);
|
|
@@ -70,7 +76,10 @@ if (!isOutside) {
|
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
if (doMask) {
|
|
73
|
-
|
|
79
|
+
bool masked = !isOutside && (maskTexel.r + maskTexel.g + maskTexel.b + maskTexel.a) > 0.0;
|
|
80
|
+
if (doInvert)
|
|
81
|
+
masked = !masked;
|
|
82
|
+
if (masked) {
|
|
74
83
|
float maskTransparency = u_pClassColorParams.w < 0.0 ? (1.0 - maskTexel.a) : u_pClassColorParams.w;
|
|
75
84
|
if (maskTransparency <= 0.0) {
|
|
76
85
|
discard;
|