Skip to content

Commit 648b10a

Browse files
committed
globe.getHeight traverses to deepest tile with a rendered mesh
1 parent 587ce95 commit 648b10a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Source/Scene/Globe.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -618,19 +618,26 @@ import TileSelectionResult from './TileSelectionResult.js';
618618
return undefined;
619619
}
620620

621+
var tileWithMesh = tile;
622+
621623
while (tile._lastSelectionResult === TileSelectionResult.REFINED) {
622624
tile = tileIfContainsCartographic(tile.southwestChild, cartographic) ||
623625
tileIfContainsCartographic(tile.southeastChild, cartographic) ||
624626
tileIfContainsCartographic(tile.northwestChild, cartographic) ||
625627
tile.northeastChild;
628+
if (defined(tile.data) && defined(tile.data.renderedMesh)) {
629+
tileWithMesh = tile;
630+
}
626631
}
627632

633+
tile = tileWithMesh;
634+
628635
// This tile was either rendered or culled.
629636
// It is sometimes useful to get a height from a culled tile,
630637
// e.g. when we're getting a height in order to place a billboard
631638
// on terrain, and the camera is looking at that same billboard.
632639
// The culled tile must have a valid mesh, though.
633-
if (!defined(tile.data) || !defined(tile.data.renderedMesh)) {
640+
if (!defined(tile)) {
634641
// Tile was not rendered (culled).
635642
return undefined;
636643
}

0 commit comments

Comments
 (0)