workaround issue with clipped tiles when scale is greater 2 on zoom-level 17

This commit is contained in:
Hannes Janetzek 2013-04-03 01:05:51 +02:00
parent 93a723af3c
commit c280bbaf50

View File

@ -321,10 +321,17 @@ public class GLRenderer implements GLSurfaceView.Renderer {
// zoom-level changed. // zoom-level changed.
float div = FastMath.pow(pos.zoomLevel - tiles[0].zoomLevel); float div = FastMath.pow(pos.zoomLevel - tiles[0].zoomLevel);
// draw additional tiles on max zoom-level:
// to make sure buildings that are half visible but
// the not ground tile are still drawn.
float scale = pos.scale;
if (scale > 2)
scale = 2;
// transform screen coordinates to tile coordinates // transform screen coordinates to tile coordinates
float tileScale = pos.scale * div * Tile.TILE_SIZE; float tileScale = scale * div * Tile.TILE_SIZE;
double px = pos.x * pos.scale; double px = pos.x * scale;
double py = pos.y * pos.scale; double py = pos.y * scale;
for (int i = 0; i < 8; i += 2) { for (int i = 0; i < 8; i += 2) {
coords[i + 0] = (float) (px + coords[i + 0]) / tileScale; coords[i + 0] = (float) (px + coords[i + 0]) / tileScale;
coords[i + 1] = (float) (py + coords[i + 1]) / tileScale; coords[i + 1] = (float) (py + coords[i + 1]) / tileScale;