From 7a22763143209fb3f3ccfc0bb15d9bc636be9953 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Wed, 14 Sep 2016 20:08:33 -0400 Subject: [PATCH] Remove texture cateory HeightMapOverlays --- data/scene/lodearth/lodearth.mod | 3 - data/scene/lodmars/lodmars.mod | 8 +- data/scene/lodmercury/lodmercury.mod | 1 - data/scene/lodmoon/lodmoon.mod | 13 +--- .../OnMoonGrayscaleOverlay.vrt | 9 +-- modules/globebrowsing/chunk/chunk.cpp | 25 ------- modules/globebrowsing/chunk/chunkrenderer.cpp | 17 ----- .../shaders/texturetilemapping.hglsl | 74 ------------------- .../globebrowsing/shaders/tilefragcolor.hglsl | 20 ----- .../shaders/tilevertexheight.hglsl | 24 ------ .../globebrowsing/tile/layeredtextures.cpp | 1 - modules/globebrowsing/tile/layeredtextures.h | 3 +- .../tile/tileprovidermanager.cpp | 7 +- 13 files changed, 12 insertions(+), 193 deletions(-) diff --git a/data/scene/lodearth/lodearth.mod b/data/scene/lodearth/lodearth.mod index ca206ebeab..b96bc12b05 100644 --- a/data/scene/lodearth/lodearth.mod +++ b/data/scene/lodearth/lodearth.mod @@ -129,9 +129,6 @@ return { DoPreProcessing = true, }, }, - HeightMapOverlays = { - - }, }, }, GuiName = "/Solar/Planets/LodEarth" diff --git a/data/scene/lodmars/lodmars.mod b/data/scene/lodmars/lodmars.mod index b28fdfabf3..f7aea14589 100644 --- a/data/scene/lodmars/lodmars.mod +++ b/data/scene/lodmars/lodmars.mod @@ -83,11 +83,7 @@ return { ]] }, NightTextures = { - --[[{ - Name = "Mars Night Texture", - FilePath = "map_datasets/MarsNight.vrt", - Enabled = true, - },]] + }, WaterMasks = { @@ -126,8 +122,6 @@ return { DoPreProcessing = true, }, }, - HeightMapOverlays = { - }, }, }, diff --git a/data/scene/lodmercury/lodmercury.mod b/data/scene/lodmercury/lodmercury.mod index 5417b492f8..db85207ead 100644 --- a/data/scene/lodmercury/lodmercury.mod +++ b/data/scene/lodmercury/lodmercury.mod @@ -68,7 +68,6 @@ return { Enabled = true, }, }, - HeightMapOverlays = { }, }, }, GuiName = "/Solar/Planets/LodMercury" diff --git a/data/scene/lodmoon/lodmoon.mod b/data/scene/lodmoon/lodmoon.mod index 6deb1918cf..278ed21aa8 100644 --- a/data/scene/lodmoon/lodmoon.mod +++ b/data/scene/lodmoon/lodmoon.mod @@ -32,25 +32,18 @@ return { }, Textures = { ColorTextures = { - { - Name = "OnMoonColor", - FilePath = "map_service_configs/OnMoonColor.xml", - Enabled = true, - }, }, GrayScaleOverlays = { + --[[ { Name = "OnMoonColorGrayscale", FilePath = "map_service_configs/OnMoonGrayscaleOverlay.vrt", Enabled = true, }, + ]] }, NightTextures = { - { - Name = "OnMoonColorGrayscale", - FilePath = "map_service_configs/OnMoonNight.vrt", - Enabled = true, - }, + }, WaterMasks = { diff --git a/data/scene/lodmoon/map_service_configs/OnMoonGrayscaleOverlay.vrt b/data/scene/lodmoon/map_service_configs/OnMoonGrayscaleOverlay.vrt index 609665b18c..6959072a78 100644 --- a/data/scene/lodmoon/map_service_configs/OnMoonGrayscaleOverlay.vrt +++ b/data/scene/lodmoon/map_service_configs/OnMoonGrayscaleOverlay.vrt @@ -17,13 +17,12 @@ Alpha - OnMoonColor.xml + white_geo.tif 1 - - + + - 255 - 1 + diff --git a/modules/globebrowsing/chunk/chunk.cpp b/modules/globebrowsing/chunk/chunk.cpp index 6af4f01ccd..da46d3ac56 100644 --- a/modules/globebrowsing/chunk/chunk.cpp +++ b/modules/globebrowsing/chunk/chunk.cpp @@ -144,31 +144,6 @@ namespace openspace { } } - const TileProviderGroup& heightmapOverlays = tileProviderManager->getTileProviderGroup(LayeredTextures::HeightMapOverlays); - TileAndTransform mostHighResHeightmapOverlay = TileSelector::getHighestResolutionTile(heightmapOverlays, _index); - if (mostHighResHeightmapOverlay.tile.status == Tile::Status::OK) { - auto preprocessData = mostHighResHeightmapOverlay.tile.preprocessData; - if (preprocessData != nullptr && preprocessData->minValues[0] < preprocessData->maxValues[0]) { - if (boundingHeights.available) { - boundingHeights.min = std::min(boundingHeights.min, preprocessData->minValues[0]); - boundingHeights.max = std::max(boundingHeights.max, preprocessData->maxValues[0]); - } - else { - boundingHeights.min = preprocessData->minValues[0]; - boundingHeights.max = preprocessData->maxValues[0]; - boundingHeights.available = true; - - if (preprocessData->hasMissingData[0]) { - boundingHeights.min = std::min(DEFAULT_HEIGHT, preprocessData->minValues[0]); - boundingHeights.max = std::max(DEFAULT_HEIGHT, preprocessData->maxValues[0]); - } - } - } - } - - - - return boundingHeights; } diff --git a/modules/globebrowsing/chunk/chunkrenderer.cpp b/modules/globebrowsing/chunk/chunkrenderer.cpp index e018f3dd13..aeec75cbe0 100644 --- a/modules/globebrowsing/chunk/chunkrenderer.cpp +++ b/modules/globebrowsing/chunk/chunkrenderer.cpp @@ -306,23 +306,6 @@ namespace openspace { i++; } - // Go through all the height map overlays and set depth tranforms - i = 0; - it = tileProviders[LayeredTextures::HeightMapOverlays].begin(); - end = tileProviders[LayeredTextures::HeightMapOverlays].end(); - for (; it != end; it++) { - auto tileProvider = *it; - - TileDepthTransform depthTransform = tileProvider->depthTransform(); - setDepthTransformUniforms( - programUniformHandler, - LayeredTextures::TextureCategory::HeightMapOverlays, - LayeredTextureShaderUniformIdHandler::BlendLayerSuffix::none, - i, - depthTransform); - i++; - } - // The length of the skirts is proportional to its size programObject->setUniform("skirtLength", min(static_cast(chunk.surfacePatch().halfSize().lat * 1000000), 8700.0f)); programObject->setUniform("xSegments", _grid->xSegments()); diff --git a/modules/globebrowsing/shaders/texturetilemapping.hglsl b/modules/globebrowsing/shaders/texturetilemapping.hglsl index 5034dcfa9d..176d861cb6 100644 --- a/modules/globebrowsing/shaders/texturetilemapping.hglsl +++ b/modules/globebrowsing/shaders/texturetilemapping.hglsl @@ -33,11 +33,6 @@ #define USE_HEIGHTMAP #{useHeightMaps} #define HEIGHTMAP_BLENDING_ENABLED #{blendHeightMaps} -// First layer type from LayeredTextureShaderProvider is height map -#define NUMLAYERS_HEIGHTMAP_OVERLAY #{lastLayerIndexHeightMapOverlays} + 1 -#define USE_HEIGHTMAP_OVERLAY #{useHeightMapOverlays} -#define HEIGHTMAP_OVERLAY_BLENDING_ENABLED #{blendHeightMapOverlays} - // Second layer type from LayeredTextureShaderProvider is color texture #define NUMLAYERS_COLORTEXTURE #{lastLayerIndexColorTextures} + 1 #define USE_COLORTEXTURE #{useColorTextures} @@ -131,75 +126,6 @@ float calculateHeight( return height; } - - -float calculateUntransformedHeightOverlay( - float currentHeight, - vec2 uv, - LevelWeights levelWeights, - const Tile heightOverlayTiles[NUMLAYERS_HEIGHTMAP_OVERLAY], - const Tile heightOverlayTilesParent1[NUMLAYERS_HEIGHTMAP_OVERLAY], - const Tile heightOverlayTilesParent2[NUMLAYERS_HEIGHTMAP_OVERLAY]) { - - float height = currentHeight; - - // The shader compiler will remove unused code when variables are multiplied by - // a constant 0 -#if !HEIGHTMAP_OVERLAY_BLENDING_ENABLED - levelWeights = getDefaultLevelWeights(); -#endif // HEIGHTMAP_OVERLAY_BLENDING_ENABLED - - #for i in 0..#{lastLayerIndexHeightMapOverlays} - { - vec4 untransformedHeightSample = - levelWeights.w1 * getTexVal(heightOverlayTiles[#{i}], uv) + - levelWeights.w2 * getTexVal(heightOverlayTilesParent1[#{i}], uv) + - levelWeights.w3 * getTexVal(heightOverlayTilesParent2[#{i}], uv); - - if (untransformedHeightSample.g > 0.5){ - // Float datasets will return un-normalized values, and needs to - // be downscaled in order to be visualized. - float scaleFactor = 0.00005; - height = scaleFactor * untransformedHeightSample.r; - } - } - #endfor - - return height; -} - -float calculateHeightOverlay( - float currentHeight, - vec2 uv, - LevelWeights levelWeights, - const Tile heightOverlayTiles[NUMLAYERS_HEIGHTMAP_OVERLAY], - const Tile heightOverlayTilesParent1[NUMLAYERS_HEIGHTMAP_OVERLAY], - const Tile heightOverlayTilesParent2[NUMLAYERS_HEIGHTMAP_OVERLAY]) { - - float height = currentHeight; - - // The shader compiler will remove unused code when variables are multiplied by - // a constant 0 -#if !HEIGHTMAP_OVERLAY_BLENDING_ENABLED - levelWeights = getDefaultLevelWeights(); -#endif // HEIGHTMAP_OVERLAY_BLENDING_ENABLED - - #for i in 0..#{lastLayerIndexHeightMapOverlays} - { - vec4 untransformedHeightSample = - levelWeights.w1 * getTexVal(heightOverlayTiles[#{i}], uv) + - levelWeights.w2 * getTexVal(heightOverlayTilesParent1[#{i}], uv) + - levelWeights.w3 * getTexVal(heightOverlayTilesParent2[#{i}], uv); - - float heightSample = getTransformedTexVal(heightOverlayTiles[#{i}].depthTransform, untransformedHeightSample.r); - if (heightSample > -100000) - height = heightSample; - } - #endfor - - return height; -} - vec4 calculateColor( const vec2 uv, LevelWeights levelWeights, diff --git a/modules/globebrowsing/shaders/tilefragcolor.hglsl b/modules/globebrowsing/shaders/tilefragcolor.hglsl index 068d527a66..028e2244a3 100644 --- a/modules/globebrowsing/shaders/tilefragcolor.hglsl +++ b/modules/globebrowsing/shaders/tilefragcolor.hglsl @@ -98,12 +98,6 @@ uniform Tile HeightMapsParent1[NUMLAYERS_HEIGHTMAP]; uniform Tile HeightMapsParent2[NUMLAYERS_HEIGHTMAP]; #endif // USE_HEIGHTMAP -#if USE_HEIGHTMAP_OVERLAY -uniform Tile HeightMapOverlays[NUMLAYERS_HEIGHTMAP_OVERLAY]; -uniform Tile HeightMapOverlaysParent1[NUMLAYERS_HEIGHTMAP_OVERLAY]; -uniform Tile HeightMapOverlaysParent2[NUMLAYERS_HEIGHTMAP_OVERLAY]; -#endif // USE_HEIGHTMAP_OVERLAY - float getUntransformedTileVertexHeight(vec2 uv, LevelWeights levelWeights){ float height = CHUNK_DEFAULT_HEIGHT; @@ -117,15 +111,6 @@ float getUntransformedTileVertexHeight(vec2 uv, LevelWeights levelWeights){ #endif // USE_HEIGHTMAP -#if USE_HEIGHTMAP_OVERLAY - height = calculateUntransformedHeightOverlay( - height, - uv, - levelWeights, // Variable to determine which texture to sample from - HeightMapOverlays, HeightMapOverlaysParent1, HeightMapOverlaysParent2); // Three textures to sample from - -#endif // USE_HEIGHTMAP_OVERLAY - return height; } @@ -237,16 +222,11 @@ vec4 getTileFragColor(){ #if SHOW_HEIGHT_RESOLUTION - color += 0.0001*calculateDebugColor(fs_uv, fs_position, vertexResolution); #if USE_HEIGHTMAP color.r = min(color.r, 0.8); color.r += tileResolution(fs_uv, HeightMaps[0]) > 0.9 ? 1 : 0; #endif - #if USE_HEIGHTMAP_OVERLAY - color.g = min(color.g, 0.8); - color.g += tileResolution(fs_uv, HeightMapOverlays[0]) > 0.9 ? 1 : 0; - #endif // USE_HEIGHTMAP_OVERLAY #endif return color; diff --git a/modules/globebrowsing/shaders/tilevertexheight.hglsl b/modules/globebrowsing/shaders/tilevertexheight.hglsl index b39cfc833c..6ea6003dcc 100644 --- a/modules/globebrowsing/shaders/tilevertexheight.hglsl +++ b/modules/globebrowsing/shaders/tilevertexheight.hglsl @@ -36,12 +36,6 @@ uniform Tile HeightMapsParent1[NUMLAYERS_HEIGHTMAP]; uniform Tile HeightMapsParent2[NUMLAYERS_HEIGHTMAP]; #endif // USE_HEIGHTMAP -#if USE_HEIGHTMAP_OVERLAY -uniform Tile HeightMapOverlays[NUMLAYERS_HEIGHTMAP_OVERLAY]; -uniform Tile HeightMapOverlaysParent1[NUMLAYERS_HEIGHTMAP_OVERLAY]; -uniform Tile HeightMapOverlaysParent2[NUMLAYERS_HEIGHTMAP_OVERLAY]; -#endif // USE_HEIGHTMAP_OVERLAY - uniform int xSegments; uniform float skirtLength; @@ -62,15 +56,6 @@ float getUntransformedTileVertexHeight(vec2 uv, LevelWeights levelWeights){ #endif // USE_HEIGHTMAP -#if USE_HEIGHTMAP_OVERLAY - height = calculateUntransformedHeightOverlay( - height, - uv, - levelWeights, // Variable to determine which texture to sample from - HeightMapOverlays, HeightMapOverlaysParent1, HeightMapOverlaysParent2); // Three textures to sample from - -#endif // USE_HEIGHTMAP_OVERLAY - return height; } @@ -88,15 +73,6 @@ float getTileVertexHeight(vec2 uv, LevelWeights levelWeights){ #endif // USE_HEIGHTMAP -#if USE_HEIGHTMAP_OVERLAY - height = calculateHeightOverlay( - height, - uv, - levelWeights, // Variable to determine which texture to sample from - HeightMapOverlays, HeightMapOverlaysParent1, HeightMapOverlaysParent2); // Three textures to sample from - -#endif // USE_HEIGHTMAP_OVERLAY - return height; } diff --git a/modules/globebrowsing/tile/layeredtextures.cpp b/modules/globebrowsing/tile/layeredtextures.cpp index dfac6dab1a..906d23986c 100644 --- a/modules/globebrowsing/tile/layeredtextures.cpp +++ b/modules/globebrowsing/tile/layeredtextures.cpp @@ -44,7 +44,6 @@ namespace openspace { "WaterMasks", "Overlays", "HeightMaps", - "HeightMapOverlays", }; } // namespace openspace diff --git a/modules/globebrowsing/tile/layeredtextures.h b/modules/globebrowsing/tile/layeredtextures.h index 94292a1f26..ab6ca68241 100644 --- a/modules/globebrowsing/tile/layeredtextures.h +++ b/modules/globebrowsing/tile/layeredtextures.h @@ -35,7 +35,7 @@ namespace openspace { public: - static const size_t NUM_TEXTURE_CATEGORIES = 7; + static const size_t NUM_TEXTURE_CATEGORIES = 6; static const size_t MAX_NUM_TEXTURES_PER_CATEGORY = 5; enum TextureCategory { @@ -45,7 +45,6 @@ namespace openspace { WaterMasks, Overlays, HeightMaps, - HeightMapOverlays, }; static const std::string TEXTURE_CATEGORY_NAMES[NUM_TEXTURE_CATEGORIES]; diff --git a/modules/globebrowsing/tile/tileprovidermanager.cpp b/modules/globebrowsing/tile/tileprovidermanager.cpp index 43dba6486e..600e531d9c 100644 --- a/modules/globebrowsing/tile/tileprovidermanager.cpp +++ b/modules/globebrowsing/tile/tileprovidermanager.cpp @@ -91,7 +91,7 @@ namespace openspace { else if (i == LayeredTextures::Overlays) { initData.minimumPixelSize = textureInitDictionary.value("OverlayMinimumSize"); } - else if (i == LayeredTextures::HeightMaps || i == LayeredTextures::HeightMapOverlays) { + else if (i == LayeredTextures::HeightMaps) { initData.minimumPixelSize = textureInitDictionary.value("HeightMapMinimumSize"); } else { @@ -101,9 +101,8 @@ namespace openspace { initData.threads = 1; initData.cacheSize = 5000; initData.framesUntilRequestQueueFlush = 60; - initData.preprocessTiles = - i == LayeredTextures::HeightMaps || - i == LayeredTextures::HeightMapOverlays; // Only preprocess height maps. + // Only preprocess height maps. + initData.preprocessTiles = i == LayeredTextures::HeightMaps; initTexures( _layerCategories[i].tileProviders,