diff --git a/data/scene/debugglobe/debugglobe.mod b/data/scene/debugglobe/debugglobe.mod index fb0ddd01b5..391ca4ffc9 100644 --- a/data/scene/debugglobe/debugglobe.mod +++ b/data/scene/debugglobe/debugglobe.mod @@ -13,11 +13,12 @@ return { FilePath = "map_service_configs/ESRI_Imagery_World_2D.wms", }, + + --[[ { Name = "Coastlines", FilePath = "map_service_configs/Coastlines.xml", }, - --[[ { Name = "VIIRS_SNPP_CorrectedReflectance_TrueColor", FilePath = "map_service_configs/VIIRS_SNPP_CorrectedReflectance_TrueColor.xml" diff --git a/data/scene/debugglobe/map_service_configs/ESRI_Imagery_World_2D.wms b/data/scene/debugglobe/map_service_configs/ESRI_Imagery_World_2D.wms index 23eebe2657..bc36b79e7e 100644 --- a/data/scene/debugglobe/map_service_configs/ESRI_Imagery_World_2D.wms +++ b/data/scene/debugglobe/map_service_configs/ESRI_Imagery_World_2D.wms @@ -12,4 +12,5 @@ 512 512 3 + 5 \ No newline at end of file diff --git a/data/scene/debugglobe/map_service_configs/frmt_wms_virtualearth.xml b/data/scene/debugglobe/map_service_configs/frmt_wms_virtualearth.xml new file mode 100644 index 0000000000..3b628e9a89 --- /dev/null +++ b/data/scene/debugglobe/map_service_configs/frmt_wms_virtualearth.xml @@ -0,0 +1,7 @@ + + + http://a${server_num}.ortho.tiles.virtualearth.net/tiles/a${quadkey}.jpeg?g=90 + + 4 + + diff --git a/data/scene/debugglobe/map_service_configs/test.wms b/data/scene/debugglobe/map_service_configs/test.wms new file mode 100644 index 0000000000..835e83473d --- /dev/null +++ b/data/scene/debugglobe/map_service_configs/test.wms @@ -0,0 +1,17 @@ + + + http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/${z}/${y}/${x} + + + + 15 + 2 + 1 + + top + + EPSG:4326 + 512 + 512 + 3 + \ No newline at end of file diff --git a/modules/globebrowsing/globes/chunkindex.cpp b/modules/globebrowsing/globes/chunkindex.cpp index 9b0230140d..06af21d7df 100644 --- a/modules/globebrowsing/globes/chunkindex.cpp +++ b/modules/globebrowsing/globes/chunkindex.cpp @@ -69,6 +69,11 @@ namespace openspace { return ChunkIndex(newX, newY, level); } + int ChunkIndex::manhattan(const ChunkIndex& other) const { + ghoul_assert(level == other.level, "makes no sense if not on same level"); + return std::abs(x - other.x) + std::abs(y - other.y); + } + HashKey ChunkIndex::hashKey() const { return x ^ (y << 16) ^ (level << 24); } diff --git a/modules/globebrowsing/globes/chunkindex.h b/modules/globebrowsing/globes/chunkindex.h index 0f70e6f690..231d7c95f8 100644 --- a/modules/globebrowsing/globes/chunkindex.h +++ b/modules/globebrowsing/globes/chunkindex.h @@ -89,6 +89,8 @@ struct ChunkIndex { */ ChunkIndex getRelatedTile(int deltaX, int deltaY) const; + int manhattan(const ChunkIndex& other) const; + HashKey hashKey() const; bool operator==(const ChunkIndex& other) const; diff --git a/modules/globebrowsing/other/TileProviderManager.cpp b/modules/globebrowsing/other/TileProviderManager.cpp index 695150ccfd..8b5cf75895 100644 --- a/modules/globebrowsing/other/TileProviderManager.cpp +++ b/modules/globebrowsing/other/TileProviderManager.cpp @@ -31,7 +31,8 @@ namespace { namespace openspace { - ThreadPool TileProviderManager::tileRequestThreadPool(5); + ThreadPool TileProviderManager::tileRequestThreadPool(1); + TileProviderManager::TileProviderManager() { diff --git a/modules/globebrowsing/other/texturedataprovider.cpp b/modules/globebrowsing/other/texturedataprovider.cpp index 96c2d64b17..889ffb52d1 100644 --- a/modules/globebrowsing/other/texturedataprovider.cpp +++ b/modules/globebrowsing/other/texturedataprovider.cpp @@ -79,16 +79,13 @@ namespace openspace { } std::shared_ptr tileData = nullptr; - //if (worstError <= CE_Warning) { tileData = createRawTileData(region, dataLayout, imageData); - //} std::shared_ptr result(new TileIOResult); result->error = worstError; result->rawTileData = tileData; return result; - //return tileData; } /* diff --git a/modules/globebrowsing/other/tileprovider.cpp b/modules/globebrowsing/other/tileprovider.cpp index ec7a504324..28e9d319c6 100644 --- a/modules/globebrowsing/other/tileprovider.cpp +++ b/modules/globebrowsing/other/tileprovider.cpp @@ -64,7 +64,6 @@ namespace openspace { bool TileProvider::hasInitializedGDAL = false; - ThreadPool TileProvider::threadPool(1); TileProvider::TileProvider( @@ -216,14 +215,23 @@ namespace openspace { bool TileProvider::enqueueTileRequest(const ChunkIndex& chunkIndex) { HashKey key = chunkIndex.hashKey(); - bool tileHasBeenQueued = _queuedTileRequests.find(key) != _queuedTileRequests.end(); - if (!tileHasBeenQueued) { - std::shared_ptr job = std::shared_ptr( - new TextureTileLoadJob(this, chunkIndex)); - _tileLoadManager.enqueueJob(job); - _queuedTileRequests.insert(key); + auto it = _queuedTileRequests.begin(); + auto end = _queuedTileRequests.end(); + for (; it != end; it++) { + const ChunkIndex& otherChunk = it->second; + if (chunkIndex.level == otherChunk.level && + chunkIndex.manhattan(otherChunk) < 1) { + return false; + } } - return !tileHasBeenQueued; + + + std::shared_ptr job = std::shared_ptr( + new TextureTileLoadJob(this, chunkIndex)); + _tileLoadManager.enqueueJob(job); + _queuedTileRequests[key] = chunkIndex; + + return true; } diff --git a/modules/globebrowsing/other/tileprovider.h b/modules/globebrowsing/other/tileprovider.h index b81b2b9ecf..ed58947267 100644 --- a/modules/globebrowsing/other/tileprovider.h +++ b/modules/globebrowsing/other/tileprovider.h @@ -140,7 +140,7 @@ namespace openspace { ////////////////////////////////////////////////////////////////////////////////// LRUCache _tileCache; - std::set _queuedTileRequests; + std::unordered_map _queuedTileRequests; int _framesSinceLastRequestFlush; int _framesUntilRequestFlush; diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl index 11ca813371..1665862311 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl @@ -54,7 +54,7 @@ Fragment getFragment() { //frag.color = frag.color * 0.9 + 0.2*vec4(samplePos, 0, 1); // Border overlay - frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02); + //frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02); frag.depth = fs_position.w; diff --git a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl index 4cfa122486..f0cb8f2ed0 100644 --- a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl @@ -59,7 +59,7 @@ Fragment getFragment() { //frag.color = frag.color * 0.9 + 0.2*vec4(samplePos, 0, 1); // Border overlay - frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02); + //frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02); frag.depth = fs_position.w;