Skip to content

Commit 1a42e12

Browse files
committed
Clip away rest of globe in inverse mode
1 parent 0cf233b commit 1a42e12

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

packages/engine/Source/Scene/GlobeSurfaceTileProvider.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,26 @@ function updateTileClippingPolygonData(
14701470
);
14711471
}
14721472

1473+
/**
1474+
* Determines whether a tile is wholly clipped away by inverse clipping. In
1475+
* inverse mode a clipped tile with no polygon geometry lies entirely outside
1476+
* every polygon, so all of it is clipped and it should not be drawn.
1477+
* @param {GlobeSurfaceTileProvider} tileProvider
1478+
* @param {GlobeSurfaceTile} surfaceTile
1479+
* @returns {boolean}
1480+
* @ignore
1481+
*/
1482+
function isTileClippedAwayByInversePolygons(tileProvider, surfaceTile) {
1483+
const clippingPolygons = tileProvider._clippingPolygons;
1484+
return (
1485+
defined(clippingPolygons) &&
1486+
clippingPolygons.enabled &&
1487+
clippingPolygons.length > 0 &&
1488+
clippingPolygons.inverse &&
1489+
(surfaceTile.clippingPolygonData?.polygonRings.length ?? 0) === 0
1490+
);
1491+
}
1492+
14731493
/**
14741494
* @param {GlobeSurfaceTileProvider} surface
14751495
* @param {FrameState} frameState
@@ -2479,6 +2499,10 @@ const defaultUndergroundColorAlphaByDistance = new NearFarScalar();
24792499
function addDrawCommandsForTile(tileProvider, tile, frameState) {
24802500
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
24812501

2502+
if (isTileClippedAwayByInversePolygons(tileProvider, surfaceTile)) {
2503+
return;
2504+
}
2505+
24822506
if (!defined(surfaceTile.vertexArray)) {
24832507
if (surfaceTile.fill === undefined) {
24842508
// No fill was created for this tile, probably because this tile is not connected to

0 commit comments

Comments
 (0)