Skip to content

Instantly share code, notes, and snippets.

@kurtraschke
Last active April 30, 2017 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurtraschke/25991ecd55a6fe04b1622f8edd7f63a0 to your computer and use it in GitHub Desktop.
Save kurtraschke/25991ecd55a6fe04b1622f8edd7f63a0 to your computer and use it in GitHub Desktop.
function visibleTilesLoaded(viewer) {
var layer = viewer.scene().layer();
var geometry = layer.geometry();
var visibleTilesForLevel = function(level) {
return geometry.visibleTiles(viewer.view(), level);
};
var tileHasTexture = function(tile) {
var tile = layer.textureStore().query(tile);
return (!tile.visible || tile.hasTexture);
};
var reduceAnd = function(a, b) {
return a && b;
};
return [].concat.apply([], geometry.levelList
.map(visibleTilesForLevel))
.map(tileHasTexture)
.reduce(reduceAnd);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment