Remove texture cateory HeightMapOverlays

This commit is contained in:
Kalle Bladin
2016-09-14 20:08:33 -04:00
parent db18bc0c1a
commit 7a22763143
13 changed files with 12 additions and 193 deletions

View File

@@ -129,9 +129,6 @@ return {
DoPreProcessing = true,
},
},
HeightMapOverlays = {
},
},
},
GuiName = "/Solar/Planets/LodEarth"

View File

@@ -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 = {
},
},
},

View File

@@ -68,7 +68,6 @@ return {
Enabled = true,
},
},
HeightMapOverlays = { },
},
},
GuiName = "/Solar/Planets/LodMercury"

View File

@@ -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 = {

View File

@@ -17,13 +17,12 @@
<VRTRasterBand dataType="Byte" band="2">
<ColorInterp>Alpha</ColorInterp>
<ComplexSource>
<SourceFilename relativeToVRT="1">OnMoonColor.xml</SourceFilename>
<SourceFilename relativeToVRT="1">white_geo.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="163840" RasterYSize="81920" DataType="Byte" BlockXSize="512" BlockYSize="512" />
<SrcRect xOff="0" yOff="0" xSize="163840" ySize="81920" />
<SourceProperties RasterXSize="163840" RasterYSize="81920" DataType="Byte" BlockXSize="512" BlockYSize="512"/>
<SrcRect xOff="0" yOff="0" xSize="32" ySize="32" />
<DstRect xOff="0" yOff="0" xSize="163840" ySize="81920" />
<ScaleOffset>255</ScaleOffset>
<ScaleRatio>1</ScaleRatio>
</ComplexSource>
</VRTRasterBand>
</VRTDataset>

View File

@@ -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;
}

View File

@@ -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<float>(chunk.surfacePatch().halfSize().lat * 1000000), 8700.0f));
programObject->setUniform("xSegments", _grid->xSegments());

View File

@@ -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,

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -44,7 +44,6 @@ namespace openspace {
"WaterMasks",
"Overlays",
"HeightMaps",
"HeightMapOverlays",
};
} // namespace openspace

View File

@@ -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];

View File

@@ -91,7 +91,7 @@ namespace openspace {
else if (i == LayeredTextures::Overlays) {
initData.minimumPixelSize = textureInitDictionary.value<double>("OverlayMinimumSize");
}
else if (i == LayeredTextures::HeightMaps || i == LayeredTextures::HeightMapOverlays) {
else if (i == LayeredTextures::HeightMaps) {
initData.minimumPixelSize = textureInitDictionary.value<double>("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,