diff --git a/worldwind/src/main/java/gov/nasa/worldwind/globe/BasicTessellator.java b/worldwind/src/main/java/gov/nasa/worldwind/globe/BasicTessellator.java index 45bb9b7d..321ccb40 100644 --- a/worldwind/src/main/java/gov/nasa/worldwind/globe/BasicTessellator.java +++ b/worldwind/src/main/java/gov/nasa/worldwind/globe/BasicTessellator.java @@ -35,7 +35,7 @@ public class BasicTessellator implements Tessellator, TileFactory { // ~0.6 meter resolution protected LevelSet levelSet = new LevelSet(new Sector().setFullSphere(), new Location(-90, -180), new Location(90, 90), 20, 32, 32); - protected double detailControl = 80; + protected double detailControl = 32; protected final List topLevelTiles = new ArrayList<>(); diff --git a/worldwind/src/main/java/gov/nasa/worldwind/shape/TiledSurfaceImage.java b/worldwind/src/main/java/gov/nasa/worldwind/shape/TiledSurfaceImage.java index 7055f119..8f6be770 100644 --- a/worldwind/src/main/java/gov/nasa/worldwind/shape/TiledSurfaceImage.java +++ b/worldwind/src/main/java/gov/nasa/worldwind/shape/TiledSurfaceImage.java @@ -34,16 +34,16 @@ public class TiledSurfaceImage extends AbstractRenderable { protected ImageOptions imageOptions; - protected double detailControl = 4; + protected double detailControl = 1; protected final List topLevelTiles = new ArrayList<>(); /** * Memory cache for this layer's subdivision tiles. Each entry contains an array of four image tiles corresponding - * to the subdivision of the group's common parent tile. The cache is configured to hold 500 groups, a number + * to the subdivision of the group's common parent tile. The cache is configured to hold 1000 groups, a number * empirically determined to be sufficient for storing the tiles needed to navigate a small region. */ - protected final LruMemoryCache tileCache = new LruMemoryCache<>(500); + protected final LruMemoryCache tileCache = new LruMemoryCache<>(1000); protected SurfaceTextureProgram activeProgram; @@ -158,6 +158,10 @@ protected void addTileOrDescendants(RenderContext rc, ImageTile tile) { ImageSource tileImageSource = tile.getImageSource(); if (tileImageSource != null) { // tile has an image source; its level is not empty Texture tileTexture = rc.getTexture(tileImageSource); + // retrieve top level tiles to avoid black holes when navigating and zooming out camera + if (tileTexture == null) { + tileTexture = rc.retrieveTexture(tileImageSource, this.imageOptions); // puts retrieved textures in the cache + } if (tileTexture != null) { // tile has a texture; use it as a fallback tile for descendants this.ancestorTile = tile; this.ancestorTexture = tileTexture; diff --git a/worldwind/src/main/java/gov/nasa/worldwind/util/Tile.java b/worldwind/src/main/java/gov/nasa/worldwind/util/Tile.java index 10e94fd8..2ae6fc3f 100755 --- a/worldwind/src/main/java/gov/nasa/worldwind/util/Tile.java +++ b/worldwind/src/main/java/gov/nasa/worldwind/util/Tile.java @@ -5,8 +5,6 @@ package gov.nasa.worldwind.util; -import android.util.DisplayMetrics; - import java.util.Arrays; import java.util.Collection; @@ -291,14 +289,7 @@ public boolean mustSubdivide(RenderContext rc, double detailFactor) { this.distanceToCamera = this.distanceToCamera(rc); double texelSize = this.texelSizeFactor * rc.globe.getEquatorialRadius(); double pixelSize = rc.pixelSizeAtDistance(this.distanceToCamera); - double densityFactor = 1.0; - - // Adjust the subdivision factory when the display density is low. Values of detailFactor have been calibrated - // against high density devices. Low density devices need roughly half the detailFactor. - if (rc.resources.getDisplayMetrics().densityDpi <= DisplayMetrics.DENSITY_MEDIUM) { - densityFactor = 0.5; - } - + double densityFactor = rc.resources.getDisplayMetrics().density; return texelSize > (pixelSize * detailFactor * densityFactor); }