Skip to content

Commit

Permalink
Render underground when clipping planes or cartographic limit are bei…
Browse files Browse the repository at this point in the history
…ng used
  • Loading branch information
lilleyse committed May 20, 2020
1 parent 4e476ab commit eaf45e0
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion Source/Scene/GlobeSurfaceTileProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,32 @@ function clipRectangleAntimeridian(tileRectangle, cartographicLimitRectangle) {
return splitRectangle;
}

function undergroundVisible(tileProvider, frameState) {
if (frameState.cameraUnderground) {
return true;
}

if (tileProvider.backFaceCulling) {
return false;
}

var clippingPlanes = tileProvider._clippingPlanes;
if (defined(clippingPlanes) && clippingPlanes.enabled) {
return true;
}

if (
!Rectangle.equals(
tileProvider.cartographicLimitRectangle,
Rectangle.MAX_VALUE
)
) {
return true;
}

return false;
}

/**
* Determines the visibility of a given tile. The tile may be fully visible, partially visible, or not
* visible at all. Tiles that are renderable and are at least partially visible will be shown by a call
Expand Down Expand Up @@ -716,6 +742,7 @@ GlobeSurfaceTileProvider.prototype.computeTileVisibility = function (
frameState.mode === SceneMode.SCENE3D &&
!ortho3D &&
defined(occluders) &&
!undergroundVisible(this, frameState) &&
!frameState.cameraUnderground
) {
var occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace;
Expand Down Expand Up @@ -1884,7 +1911,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
defaultundergroundColorAlphaByDistance
);
var showUndergroundColor =
cameraUnderground &&
undergroundVisible(tileProvider, frameState) &&
frameState.mode === SceneMode.SCENE3D &&
undergroundColor.alpha > 0.0 &&
(undergroundColorAlphaByDistance.nearValue > 0.0 ||
Expand Down

0 comments on commit eaf45e0

Please sign in to comment.