mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-10 23:38:38 -05:00
Rename TileAndTransform to ChunkTile
This commit is contained in:
@@ -54,7 +54,7 @@ set(HEADER_FILES
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tilepile.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tile.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileandtransform.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/chunktile.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileindex.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileselector.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tilediskcache.h
|
||||
@@ -110,7 +110,7 @@ set(SOURCE_FILES
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tilepile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileandtransform.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/chunktile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileindex.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tileselector.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tile/tilediskcache.cpp
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace globebrowsing {
|
||||
|
||||
size_t HEIGHT_CHANNEL = 0;
|
||||
const TileProviderGroup& heightmaps = tileProviderManager->getTileProviderGroup(LayeredTextures::HeightMaps);
|
||||
std::vector<TileAndTransform> tiles = TileSelector::getTilesSortedByHighestResolution(heightmaps, _tileIndex);
|
||||
std::vector<ChunkTile> tiles = TileSelector::getTilesSortedByHighestResolution(heightmaps, _tileIndex);
|
||||
bool lastHadMissingData = true;
|
||||
for (auto tile : tiles) {
|
||||
bool goodTile = tile.tile.status == Tile::Status::OK;
|
||||
|
||||
@@ -126,12 +126,12 @@ namespace globebrowsing {
|
||||
LayeredTextures::BlendLayerSuffixes blendLayerSuffix,
|
||||
size_t layerIndex,
|
||||
ghoul::opengl::TextureUnit& texUnit,
|
||||
const TileAndTransform& tileAndTransform)
|
||||
const ChunkTile& chunkTile)
|
||||
{
|
||||
// Blend tile with two parents
|
||||
// The texture needs a unit to sample from
|
||||
texUnit.activate();
|
||||
tileAndTransform.tile.texture->bind();
|
||||
chunkTile.tile.texture->bind();
|
||||
|
||||
uniformIdHandler->programObject().setUniform(
|
||||
uniformIdHandler->getId(
|
||||
@@ -146,14 +146,14 @@ namespace globebrowsing {
|
||||
blendLayerSuffix,
|
||||
layerIndex,
|
||||
LayeredTextures::GlslTileDataId::uvTransform_uvScale),
|
||||
tileAndTransform.uvTransform.uvScale);
|
||||
chunkTile.uvTransform.uvScale);
|
||||
uniformIdHandler->programObject().setUniform(
|
||||
uniformIdHandler->getId(
|
||||
textureCategory,
|
||||
blendLayerSuffix,
|
||||
layerIndex,
|
||||
LayeredTextures::GlslTileDataId::uvTransform_uvOffset),
|
||||
tileAndTransform.uvTransform.uvOffset);
|
||||
chunkTile.uvTransform.uvOffset);
|
||||
}
|
||||
|
||||
void ChunkRenderer::setLayerSettingsUniforms(
|
||||
@@ -257,11 +257,11 @@ namespace globebrowsing {
|
||||
auto tileProvider = it->get();
|
||||
|
||||
// Get the texture that should be used for rendering
|
||||
TileAndTransform tileAndTransform = TileSelector::getHighestResolutionTile(tileProvider, tileIndex);
|
||||
if (tileAndTransform.tile.status == Tile::Status::Unavailable) {
|
||||
tileAndTransform.tile = tileProvider->getDefaultTile();
|
||||
tileAndTransform.uvTransform.uvOffset = { 0, 0 };
|
||||
tileAndTransform.uvTransform.uvScale = { 1, 1 };
|
||||
ChunkTile chunkTile = TileSelector::getHighestResolutionTile(tileProvider, tileIndex);
|
||||
if (chunkTile.tile.status == Tile::Status::Unavailable) {
|
||||
chunkTile.tile = tileProvider->getDefaultTile();
|
||||
chunkTile.uvTransform.uvOffset = { 0, 0 };
|
||||
chunkTile.uvTransform.uvScale = { 1, 1 };
|
||||
}
|
||||
|
||||
activateTileAndSetTileUniforms(
|
||||
@@ -270,13 +270,13 @@ namespace globebrowsing {
|
||||
LayeredTextures::BlendLayerSuffixes::none,
|
||||
i,
|
||||
texUnits[category][i].blendTexture0,
|
||||
tileAndTransform);
|
||||
chunkTile);
|
||||
|
||||
// If blending is enabled, two more textures are needed
|
||||
if (layeredTexturePreprocessingData.layeredTextureInfo[category].layerBlendingEnabled) {
|
||||
TileAndTransform tileAndTransformParent1 = TileSelector::getHighestResolutionTile(tileProvider, tileIndex, 1);
|
||||
if (tileAndTransformParent1.tile.status == Tile::Status::Unavailable) {
|
||||
tileAndTransformParent1 = tileAndTransform;
|
||||
ChunkTile chunkTileParent1 = TileSelector::getHighestResolutionTile(tileProvider, tileIndex, 1);
|
||||
if (chunkTileParent1.tile.status == Tile::Status::Unavailable) {
|
||||
chunkTileParent1 = chunkTile;
|
||||
}
|
||||
activateTileAndSetTileUniforms(
|
||||
programUniformHandler,
|
||||
@@ -284,11 +284,11 @@ namespace globebrowsing {
|
||||
LayeredTextures::BlendLayerSuffixes::Parent1,
|
||||
i,
|
||||
texUnits[category][i].blendTexture1,
|
||||
tileAndTransformParent1);
|
||||
chunkTileParent1);
|
||||
|
||||
TileAndTransform tileAndTransformParent2 = TileSelector::getHighestResolutionTile(tileProvider, tileIndex, 2);
|
||||
if (tileAndTransformParent2.tile.status == Tile::Status::Unavailable) {
|
||||
tileAndTransformParent2 = tileAndTransformParent1;
|
||||
ChunkTile chunkTileParent2 = TileSelector::getHighestResolutionTile(tileProvider, tileIndex, 2);
|
||||
if (chunkTileParent2.tile.status == Tile::Status::Unavailable) {
|
||||
chunkTileParent2 = chunkTileParent1;
|
||||
}
|
||||
activateTileAndSetTileUniforms(
|
||||
programUniformHandler,
|
||||
@@ -296,7 +296,7 @@ namespace globebrowsing {
|
||||
LayeredTextures::BlendLayerSuffixes::Parent2,
|
||||
i,
|
||||
texUnits[category][i].blendTexture2,
|
||||
tileAndTransformParent2);
|
||||
chunkTileParent2);
|
||||
}
|
||||
|
||||
setLayerSettingsUniforms(
|
||||
@@ -306,8 +306,8 @@ namespace globebrowsing {
|
||||
_tileProviderManager->getTileProviderGroup(category).getActiveNamedTileProviders()[i].settings);
|
||||
|
||||
/*
|
||||
if (category == LayeredTextures::HeightMaps && tileAndTransform.tile.preprocessData) {
|
||||
//auto preprocessingData = tileAndTransform.tile.preprocessData;
|
||||
if (category == LayeredTextures::HeightMaps && chunkTile.tile.preprocessData) {
|
||||
//auto preprocessingData = chunkTile.tile.preprocessData;
|
||||
//float noDataValue = preprocessingData->noDataValues[0];
|
||||
programObject->setUniform(
|
||||
"minimumValidHeight[" + std::to_string(i) + "]",
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace globebrowsing {
|
||||
LayeredTextures::BlendLayerSuffixes blendLayerSuffix,
|
||||
size_t layerIndex,
|
||||
ghoul::opengl::TextureUnit& texUnit,
|
||||
const TileAndTransform& tileAndTransform);
|
||||
const ChunkTile& chunkTile);
|
||||
|
||||
void setLayerSettingsUniforms(
|
||||
std::shared_ptr<LayeredTextureShaderUniformIdHandler> uniformIdHandler,
|
||||
|
||||
@@ -297,10 +297,10 @@ namespace globebrowsing {
|
||||
geoDiffPoint.lon / geoDiffPatch.lon, geoDiffPoint.lat / geoDiffPatch.lat);
|
||||
|
||||
// Transform the uv coordinates to the current tile texture
|
||||
TileAndTransform tileAndTransform = TileSelector::getHighestResolutionTile(
|
||||
ChunkTile chunkTile = TileSelector::getHighestResolutionTile(
|
||||
tileProvider.get(), chunkIdx);
|
||||
const auto& tile = tileAndTransform.tile;
|
||||
const auto& uvTransform = tileAndTransform.uvTransform;
|
||||
const auto& tile = chunkTile.tile;
|
||||
const auto& uvTransform = chunkTile.uvTransform;
|
||||
const auto& depthTransform = tileProvider->depthTransform();
|
||||
if (tile.status != Tile::Status::OK) {
|
||||
return 0;
|
||||
|
||||
155
modules/globebrowsing/layer/layer.cpp
Normal file
155
modules/globebrowsing/layer/layer.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/layer/layer.h>
|
||||
|
||||
#include <modules/globebrowsing/tile/tileprovider/tileprovider.h>
|
||||
#include <modules/globebrowsing/tile/tileselector.h>
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "Layer";
|
||||
|
||||
const std::string KEY_NAME = "Name";
|
||||
const std::string KEY_ENABLED = "Enabled";
|
||||
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
namespace globebrowsing {
|
||||
|
||||
Layer::Layer(const ghoul::Dictionary& dict){
|
||||
dict.getValue(KEY_NAME, _name);
|
||||
dict.getValue(KEY_ENABLED, _enabled);
|
||||
_tileProvider = std::unique_ptr<TileProvider>(TileProvider::createFromDictionary(dict));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Layer::bind(ProgramObject* programObject, const TileIndex& tileIndex){
|
||||
/*
|
||||
ChunkTile tat = TileSelector::getHighestResolutionTile(_tileProvider.get(), tileIndex);
|
||||
if (tat.tile.status == Tile::Status::Unavailable) {
|
||||
tat.tile = _tileProvider->getDefaultTile();
|
||||
tat.uvTransform.uvOffset = { 0, 0 };
|
||||
tat.uvTransform.uvScale = { 1, 1 };
|
||||
}
|
||||
|
||||
activateTileAndSetTileUniforms(
|
||||
programUniformHandler,
|
||||
LayeredTextures::TextureCategory(category),
|
||||
LayeredTextures::BlendLayerSuffixes::none,
|
||||
i,
|
||||
texUnits[category][i].blendTexture0,
|
||||
tat);
|
||||
|
||||
// If blending is enabled, two more textures are needed
|
||||
if (layeredTexturePreprocessingData.layeredTextureInfo[category].layerBlendingEnabled) {
|
||||
tat tatParent1 = TileSelector::getHighestResolutionTile(_tileProvider.get(), tileIndex, 1);
|
||||
if (tatParent1.tile.status == Tile::Status::Unavailable) {
|
||||
tatParent1 = tat;
|
||||
}
|
||||
activateTileAndSetTileUniforms(
|
||||
programUniformHandler,
|
||||
LayeredTextures::TextureCategory(category),
|
||||
LayeredTextures::BlendLayerSuffixes::Parent1,
|
||||
i,
|
||||
texUnits[category][i].blendTexture1,
|
||||
tatParent1);
|
||||
|
||||
ChunkTile tatParent2 = TileSelector::getHighestResolutionTile(_tileProvider.get(), tileIndex, 2);
|
||||
if (tatParent2.tile.status == Tile::Status::Unavailable) {
|
||||
tatParent2 = tatParent1;
|
||||
}
|
||||
activateTileAndSetTileUniforms(
|
||||
programUniformHandler,
|
||||
LayeredTextures::TextureCategory(category),
|
||||
LayeredTextures::BlendLayerSuffixes::Parent2,
|
||||
i,
|
||||
texUnits[category][i].blendTexture2,
|
||||
tatParent2);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
/*
|
||||
void Layer::ensureIdsAreUpdated(LayeredTextureShaderProvider* shaderProvider){
|
||||
if (shaderProvider->updatedOnLastCall())
|
||||
{
|
||||
_shaderProvider = shaderProvider;
|
||||
// Ignore errors since this loops through even uniforms that does not exist.
|
||||
_shaderProvider->_programObject->setIgnoreUniformLocationError(
|
||||
ProgramObject::IgnoreError::Yes);
|
||||
for (size_t i = 0; i < LayeredTextures::NUM_TEXTURE_CATEGORIES; i++)
|
||||
{
|
||||
for (size_t j = 0; j < LayeredTextures::NUM_BLEND_TEXTURES; j++)
|
||||
{
|
||||
for (size_t k = 0; k < LayeredTextures::MAX_NUM_TEXTURES_PER_CATEGORY;
|
||||
k++)
|
||||
{
|
||||
for (size_t l = 0; l < LayeredTextures::NUM_TILE_DATA_VARIABLES; l++)
|
||||
{
|
||||
_tileUniformIds[i][j][k][l] =
|
||||
_shaderProvider->_programObject->uniformLocation(
|
||||
LayeredTextures::TEXTURE_CATEGORY_NAMES[i] +
|
||||
LayeredTextures::blendLayerSuffixes[j] +
|
||||
"[" + std::to_string(k) + "]." +
|
||||
LayeredTextures::glslTileDataNames[l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < LayeredTextures::NUM_TEXTURE_CATEGORIES; i++)
|
||||
{
|
||||
for (size_t k = 0; k < LayeredTextures::MAX_NUM_TEXTURES_PER_CATEGORY;
|
||||
k++)
|
||||
{
|
||||
for (size_t l = 0; l < LayeredTextures::NUM_LAYER_SETTINGS_VARIABLES; l++)
|
||||
{
|
||||
_layerSettingsUniformIds[i][k][l] =
|
||||
_shaderProvider->_programObject->uniformLocation(
|
||||
LayeredTextures::TEXTURE_CATEGORY_NAMES[i] +
|
||||
"Settings" +
|
||||
"[" + std::to_string(k) + "]." +
|
||||
LayeredTextures::layerSettingsIds[l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reset ignore errors
|
||||
_shaderProvider->_programObject->setIgnoreUniformLocationError(
|
||||
ProgramObject::IgnoreError::No);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
} // namespace globebrowsing
|
||||
} // namespace openspace
|
||||
72
modules/globebrowsing/layer/layer.h
Normal file
72
modules/globebrowsing/layer/layer.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef LAYER_H
|
||||
#define LAYER_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <modules/globebrowsing/layered_rendering/perlayersetting.h>
|
||||
#include <modules/globebrowsing/tile/tileindex.h>
|
||||
|
||||
namespace openspace {
|
||||
namespace globebrowsing {
|
||||
|
||||
class TileProvider;
|
||||
|
||||
class Layer : public properties::PropertyOwner {
|
||||
public:
|
||||
Layer(const ghoul::Dictionary& dict);
|
||||
|
||||
void bind(ProgramObject* program, const TileIndex& tileIndex);
|
||||
|
||||
|
||||
static const size_t NUM_LAYER_SETTINGS_VARIABLES = 3;
|
||||
static const size_t NUM_TILE_DATA_VARIABLES = 3;
|
||||
static const size_t NUM_BLEND_TEXTURES = 3;
|
||||
|
||||
private:
|
||||
|
||||
//void ensureIdsAreUpdated(LayeredTextureShaderProvider* shaderProvider);
|
||||
|
||||
|
||||
std::string _name;
|
||||
std::unique_ptr<TileProvider> _tileProvider;
|
||||
|
||||
std::array<std::array<GLint, NUM_TILE_DATA_VARIABLES>,NUM_BLEND_TEXTURES> _tileUniformIds;
|
||||
std::array<GLint, NUM_LAYER_SETTINGS_VARIABLES> _layerSettingsUniformIds;
|
||||
|
||||
bool _enabled;
|
||||
|
||||
};
|
||||
|
||||
} // namespace globebrowsing
|
||||
} // namespace openspace
|
||||
#endif // LAYER_H
|
||||
@@ -22,12 +22,12 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/tile/tileandtransform.h>
|
||||
#include <modules/globebrowsing/tile/chunktile.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "TileAndTransform";
|
||||
const std::string _loggerCat = "ChunkTile";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -39,7 +39,7 @@ namespace globebrowsing {
|
||||
glm::vec2 uvScale;
|
||||
};
|
||||
|
||||
struct TileAndTransform {
|
||||
struct ChunkTile {
|
||||
Tile tile;
|
||||
TileUvTransform uvTransform;
|
||||
};
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <ghoul/opengl/programobject.h> // Texture
|
||||
|
||||
#include <modules/globebrowsing/tile/tile.h>
|
||||
#include <modules/globebrowsing/tile/tileandtransform.h>
|
||||
#include <modules/globebrowsing/tile/chunktile.h>
|
||||
#include <modules/globebrowsing/tile/tileindex.h>
|
||||
#include <modules/globebrowsing/tile/tileprovider/tileprovider.h>
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace globebrowsing {
|
||||
void bind(ProgramObject* programObject);
|
||||
|
||||
private:
|
||||
std::vector<TileAndTransform> pile;
|
||||
std::vector<ChunkTile> pile;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace globebrowsing {
|
||||
|
||||
const TileSelector::CompareResolution TileSelector::HIGHEST_RES = TileSelector::CompareResolution();
|
||||
|
||||
TileAndTransform TileSelector::getHighestResolutionTile(TileProvider* tileProvider, TileIndex tileIndex, int parents) {
|
||||
ChunkTile TileSelector::getHighestResolutionTile(TileProvider* tileProvider, TileIndex tileIndex, int parents) {
|
||||
TileUvTransform uvTransform;
|
||||
uvTransform.uvOffset = glm::vec2(0, 0);
|
||||
uvTransform.uvScale = glm::vec2(1, 1);
|
||||
@@ -72,33 +72,33 @@ namespace globebrowsing {
|
||||
return{ Tile::TileUnavailable, uvTransform };
|
||||
}
|
||||
|
||||
TileAndTransform TileSelector::getHighestResolutionTile(const TileProviderGroup& tileProviderGroup, TileIndex tileIndex) {
|
||||
TileAndTransform mostHighResolution;
|
||||
ChunkTile TileSelector::getHighestResolutionTile(const TileProviderGroup& tileProviderGroup, TileIndex tileIndex) {
|
||||
ChunkTile mostHighResolution;
|
||||
mostHighResolution.tile = Tile::TileUnavailable;
|
||||
mostHighResolution.uvTransform.uvScale.x = 0;
|
||||
|
||||
auto activeProviders = tileProviderGroup.getActiveTileProviders();
|
||||
for (size_t i = 0; i < activeProviders.size(); i++) {
|
||||
TileAndTransform tileAndTransform = getHighestResolutionTile(activeProviders[i].get(), tileIndex);
|
||||
bool tileIsOk = tileAndTransform.tile.status == Tile::Status::OK;
|
||||
bool tileHasPreprocessData = tileAndTransform.tile.preprocessData != nullptr;
|
||||
bool tileIsHigherResolution = tileAndTransform.uvTransform.uvScale.x > mostHighResolution.uvTransform.uvScale.x;
|
||||
ChunkTile chunkTile = getHighestResolutionTile(activeProviders[i].get(), tileIndex);
|
||||
bool tileIsOk = chunkTile.tile.status == Tile::Status::OK;
|
||||
bool tileHasPreprocessData = chunkTile.tile.preprocessData != nullptr;
|
||||
bool tileIsHigherResolution = chunkTile.uvTransform.uvScale.x > mostHighResolution.uvTransform.uvScale.x;
|
||||
if (tileIsOk && tileHasPreprocessData && tileIsHigherResolution) {
|
||||
mostHighResolution = tileAndTransform;
|
||||
mostHighResolution = chunkTile;
|
||||
}
|
||||
}
|
||||
|
||||
return mostHighResolution;
|
||||
}
|
||||
|
||||
bool TileSelector::CompareResolution::operator()(const TileAndTransform& a, const TileAndTransform& b) {
|
||||
bool TileSelector::CompareResolution::operator()(const ChunkTile& a, const ChunkTile& b) {
|
||||
// large uv scale means smaller resolution
|
||||
return a.uvTransform.uvScale.x > b.uvTransform.uvScale.x;
|
||||
}
|
||||
|
||||
std::vector<TileAndTransform> TileSelector::getTilesSortedByHighestResolution(const TileProviderGroup& tileProviderGroup, const TileIndex& tileIndex) {
|
||||
std::vector<ChunkTile> TileSelector::getTilesSortedByHighestResolution(const TileProviderGroup& tileProviderGroup, const TileIndex& tileIndex) {
|
||||
auto activeProviders = tileProviderGroup.getActiveTileProviders();
|
||||
std::vector<TileAndTransform> tiles;
|
||||
std::vector<ChunkTile> tiles;
|
||||
for (auto provider : activeProviders){
|
||||
tiles.push_back(getHighestResolutionTile(provider.get(), tileIndex));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <modules/globebrowsing/tile/tileindex.h>
|
||||
#include <modules/globebrowsing/tile/tile.h>
|
||||
#include <modules/globebrowsing/tile/tileprovidermanager.h>
|
||||
#include <modules/globebrowsing/tile/tileandtransform.h>
|
||||
#include <modules/globebrowsing/tile/chunktile.h>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
@@ -37,12 +37,12 @@ namespace globebrowsing {
|
||||
|
||||
class TileSelector {
|
||||
public:
|
||||
static TileAndTransform getHighestResolutionTile(TileProvider* tileProvider, TileIndex tileIndex, int parents = 0);
|
||||
static TileAndTransform getHighestResolutionTile(const TileProviderGroup& tileProviderGroup, TileIndex tileIndex);
|
||||
static std::vector<TileAndTransform> getTilesSortedByHighestResolution(const TileProviderGroup&, const TileIndex& tileIndex);
|
||||
static ChunkTile getHighestResolutionTile(TileProvider* tileProvider, TileIndex tileIndex, int parents = 0);
|
||||
static ChunkTile getHighestResolutionTile(const TileProviderGroup& tileProviderGroup, TileIndex tileIndex);
|
||||
static std::vector<ChunkTile> getTilesSortedByHighestResolution(const TileProviderGroup&, const TileIndex& tileIndex);
|
||||
|
||||
struct CompareResolution {
|
||||
bool operator() (const TileAndTransform& a, const TileAndTransform& b);
|
||||
bool operator() (const ChunkTile& a, const ChunkTile& b);
|
||||
};
|
||||
|
||||
static const CompareResolution HIGHEST_RES;
|
||||
|
||||
Reference in New Issue
Block a user