mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 20:50:19 -06:00
1 Thread for Tile loading, allowing MaxConnections concurrent connections per RasterIO
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -12,4 +12,5 @@
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>5</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,7 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="VirtualEarth">
|
||||
<ServerUrl>http://a${server_num}.ortho.tiles.virtualearth.net/tiles/a${quadkey}.jpeg?g=90</ServerUrl>
|
||||
</Service>
|
||||
<MaxConnections>4</MaxConnections>
|
||||
<Cache/>
|
||||
</GDAL_WMS>
|
||||
17
data/scene/debugglobe/map_service_configs/test.wms
Normal file
17
data/scene/debugglobe/map_service_configs/test.wms
Normal file
@@ -0,0 +1,17 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
|
||||
<TileLevel>15</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
ThreadPool TileProviderManager::tileRequestThreadPool(5);
|
||||
ThreadPool TileProviderManager::tileRequestThreadPool(1);
|
||||
|
||||
|
||||
TileProviderManager::TileProviderManager()
|
||||
{
|
||||
|
||||
@@ -79,16 +79,13 @@ namespace openspace {
|
||||
}
|
||||
|
||||
std::shared_ptr<RawTileData> tileData = nullptr;
|
||||
//if (worstError <= CE_Warning) {
|
||||
tileData = createRawTileData(region, dataLayout, imageData);
|
||||
//}
|
||||
|
||||
std::shared_ptr<TileIOResult> result(new TileIOResult);
|
||||
result->error = worstError;
|
||||
result->rawTileData = tileData;
|
||||
|
||||
return result;
|
||||
//return tileData;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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<TextureTileLoadJob> job = std::shared_ptr<TextureTileLoadJob>(
|
||||
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<TextureTileLoadJob> job = std::shared_ptr<TextureTileLoadJob>(
|
||||
new TextureTileLoadJob(this, chunkIndex));
|
||||
_tileLoadManager.enqueueJob(job);
|
||||
_queuedTileRequests[key] = chunkIndex;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace openspace {
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LRUCache<HashKey, MetaTexture> _tileCache;
|
||||
std::set<HashKey> _queuedTileRequests;
|
||||
std::unordered_map<HashKey, ChunkIndex> _queuedTileRequests;
|
||||
|
||||
int _framesSinceLastRequestFlush;
|
||||
int _framesUntilRequestFlush;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user