Enable TileProvider to provide Nth highest resolution tile

This commit is contained in:
Erik Broberg
2016-06-02 11:09:15 -04:00
parent bc98f7486f
commit 4e9dfce160
3 changed files with 70 additions and 71 deletions

View File

@@ -166,18 +166,23 @@ namespace openspace {
auto tileProvider = it->get();
// Get the texture that should be used for rendering
Tile tile = tileProvider->getHighestResolutionTile(chunk.index());
Tile tileParent1 = tileProvider->getHighestResolutionParentTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionParentTile(chunk.index(), 2);
if (tile.texture == nullptr ||
tileParent1.texture == nullptr ||
tileParent2.texture == nullptr)
{
Tile tileParent1 = tileProvider->getHighestResolutionTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionTile(chunk.index(), 2);
if (tile.texture == nullptr) {
// don't render if no tile was available
programObject->deactivate();
return;
}
if (tileParent1.texture == nullptr) {
tileParent1 = tile;
}
if (tileParent2.texture == nullptr) {
tileParent2 = tileParent1;
}
TileDepthTransform depthTransform = tileProvider->depthTransform();
// The texture needs a unit to sample from
@@ -247,19 +252,23 @@ namespace openspace {
auto tileProvider = it->get();
// Get the texture that should be used for rendering
Tile tile = tileProvider->getHighestResolutionTile(chunk.index());
Tile tileParent1 = tileProvider->getHighestResolutionParentTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionParentTile(chunk.index(), 2);
Tile tileParent1 = tileProvider->getHighestResolutionTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionTile(chunk.index(), 2);
if (tile.texture == nullptr ||
tileParent1.texture == nullptr ||
tileParent2.texture == nullptr)
{
if (tile.texture == nullptr) {
// don't render if no tile was available
programObject->deactivate();
return;
}
if (tileParent1.texture == nullptr) {
tileParent1 = tile;
}
if (tileParent2.texture == nullptr) {
tileParent2 = tileParent1;
}
// The texture needs a unit to sample from
texUnitColor[i].activate();
tile.texture->bind();
@@ -410,18 +419,22 @@ namespace openspace {
auto tileProvider = it->get();
// Get the texture that should be used for rendering
Tile tile = tileProvider->getHighestResolutionTile(chunk.index());
Tile tileParent1 = tileProvider->getHighestResolutionParentTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionParentTile(chunk.index(), 2);
Tile tileParent1 = tileProvider->getHighestResolutionTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionTile(chunk.index(), 2);
if (tile.texture == nullptr ||
tileParent1.texture == nullptr ||
tileParent2.texture == nullptr)
{
if (tile.texture == nullptr) {
// don't render if no tile was available
programObject->deactivate();
return;
}
if (tileParent1.texture == nullptr) {
tileParent1 = tile;
}
if (tileParent2.texture == nullptr) {
tileParent2 = tileParent1;
}
TileDepthTransform depthTransform = tileProvider->depthTransform();
// The texture needs a unit to sample from
@@ -490,19 +503,23 @@ namespace openspace {
auto tileProvider = it->get();
// Get the texture that should be used for rendering
Tile tile = tileProvider->getHighestResolutionTile(chunk.index());
Tile tileParent1 = tileProvider->getHighestResolutionParentTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionParentTile(chunk.index(), 2);
Tile tileParent1 = tileProvider->getHighestResolutionTile(chunk.index(), 1);
Tile tileParent2 = tileProvider->getHighestResolutionTile(chunk.index(), 2);
if (tile.texture == nullptr ||
tileParent1.texture == nullptr ||
tileParent2.texture == nullptr)
{
if (tile.texture == nullptr) {
// don't render if no tile was available
programObject->deactivate();
return;
}
if (tileParent1.texture == nullptr) {
tileParent1 = tile;
}
if (tileParent2.texture == nullptr) {
tileParent2 = tileParent1;
}
// The texture needs a unit to sample from
texUnitColor[i].activate();
tile.texture->bind();