Skip to content

Commit

Permalink
globe.getHeight traverses to deepest tile with a rendered mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Jan 2, 2020
1 parent 587ce95 commit 648b10a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/Scene/Globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,19 +618,26 @@ import TileSelectionResult from './TileSelectionResult.js';
return undefined;
}

var tileWithMesh = tile;

while (tile._lastSelectionResult === TileSelectionResult.REFINED) {
tile = tileIfContainsCartographic(tile.southwestChild, cartographic) ||
tileIfContainsCartographic(tile.southeastChild, cartographic) ||
tileIfContainsCartographic(tile.northwestChild, cartographic) ||
tile.northeastChild;
if (defined(tile.data) && defined(tile.data.renderedMesh)) {
tileWithMesh = tile;
}
}

tile = tileWithMesh;

// This tile was either rendered or culled.
// It is sometimes useful to get a height from a culled tile,
// e.g. when we're getting a height in order to place a billboard
// on terrain, and the camera is looking at that same billboard.
// The culled tile must have a valid mesh, though.
if (!defined(tile.data) || !defined(tile.data.renderedMesh)) {
if (!defined(tile)) {
// Tile was not rendered (culled).
return undefined;
}
Expand Down

0 comments on commit 648b10a

Please sign in to comment.