@@ -1435,6 +1435,26 @@ function updateTileClippingPolygonData(
14351435 ) ;
14361436}
14371437
1438+ /**
1439+ * Determines whether a tile is wholly clipped away by inverse clipping. In
1440+ * inverse mode a clipped tile with no polygon geometry lies entirely outside
1441+ * every polygon, so all of it is clipped and it should not be drawn.
1442+ * @param {GlobeSurfaceTileProvider } tileProvider
1443+ * @param {GlobeSurfaceTile } surfaceTile
1444+ * @returns {boolean }
1445+ * @ignore
1446+ */
1447+ function isTileClippedAwayByInversePolygons ( tileProvider , surfaceTile ) {
1448+ const clippingPolygons = tileProvider . _clippingPolygons ;
1449+ return (
1450+ defined ( clippingPolygons ) &&
1451+ clippingPolygons . enabled &&
1452+ clippingPolygons . length > 0 &&
1453+ clippingPolygons . inverse &&
1454+ ( surfaceTile . clippingPolygonData ?. polygonRings . length ?? 0 ) === 0
1455+ ) ;
1456+ }
1457+
14381458/**
14391459 * @param {GlobeSurfaceTileProvider } surface
14401460 * @param {FrameState } frameState
@@ -2443,6 +2463,10 @@ const defaultUndergroundColorAlphaByDistance = new NearFarScalar();
24432463function addDrawCommandsForTile ( tileProvider , tile , frameState ) {
24442464 const surfaceTile = /** @type {GlobeSurfaceTile } */ ( tile . data ) ;
24452465
2466+ if ( isTileClippedAwayByInversePolygons ( tileProvider , surfaceTile ) ) {
2467+ return ;
2468+ }
2469+
24462470 if ( ! defined ( surfaceTile . vertexArray ) ) {
24472471 if ( surfaceTile . fill === undefined ) {
24482472 // No fill was created for this tile, probably because this tile is not connected to
0 commit comments