Merge branch 'feature/globebrowsing' of github.com:OpenSpace/OpenSpace-Development into feature/globebrowsing

This commit is contained in:
Kalle Bladin
2016-06-14 00:20:55 -04:00
7 changed files with 27 additions and 8 deletions

View File

@@ -160,7 +160,7 @@ namespace openspace {
Vec3 cameraToEllipseCenter = globePosition - cameraPosition;
Geodetic2 camPos = ellipsoid.cartesianToGeodetic2(cameraPosition);
/*
struct CornerDist {
Geodetic2 corner;
float dist;
@@ -190,6 +190,14 @@ namespace openspace {
const Geodetic3 c1 = { cornerDists[1].corner, heights.min };
const Geodetic3 c2 = { cornerDists[2].corner, heights.max };
const Geodetic3 c3 = { cornerDists[3].corner, heights.max };
*/
Chunk::BoundingHeights heights = chunk.getBoundingHeights();
const Geodetic3 c0 = { chunk.surfacePatch().getCorner((Quad)0), heights.min };
const Geodetic3 c1 = { chunk.surfacePatch().getCorner((Quad)1), heights.min };
const Geodetic3 c2 = { chunk.surfacePatch().getCorner((Quad)2), heights.min };
const Geodetic3 c3 = { chunk.surfacePatch().getCorner((Quad)3), heights.min };
Vec3 A = cameraToEllipseCenter + ellipsoid.cartesianPosition(c0);
Vec3 B = cameraToEllipseCenter + ellipsoid.cartesianPosition(c1);

View File

@@ -129,9 +129,11 @@ namespace openspace {
desiredLevel = _chunkEvaluatorByDistance->getDesiredLevel(chunk, renderData);
}
int desiredLevelByAvailableData = _chunkEvaluatorByAvailableTiles->getDesiredLevel(chunk, renderData);
if (desiredLevelByAvailableData != DesiredChunkLevelEvaluator::UNKNOWN_DESIRED_LEVEL) {
desiredLevel = min(desiredLevel, desiredLevelByAvailableData);
if (limitLevelByAvailableHeightData) {
int desiredLevelByAvailableData = _chunkEvaluatorByAvailableTiles->getDesiredLevel(chunk, renderData);
if (desiredLevelByAvailableData != DesiredChunkLevelEvaluator::UNKNOWN_DESIRED_LEVEL) {
desiredLevel = min(desiredLevel, desiredLevelByAvailableData);
}
}
desiredLevel = glm::clamp(desiredLevel, minSplitDepth, maxSplitDepth);

View File

@@ -109,6 +109,7 @@ namespace openspace {
bool atmosphereEnabled;
bool showChunkEdges;
bool levelByProjArea;
bool limitLevelByAvailableHeightData;
private:

View File

@@ -71,6 +71,7 @@ namespace openspace {
, atmosphereEnabled(properties::BoolProperty("atmosphereEnabled", "atmosphereEnabled", false))
, showChunkEdges(properties::BoolProperty("showChunkEdges", "showChunkEdges", false))
, levelByProjArea(properties::BoolProperty("levelByProjArea", "levelByProjArea", true))
, limitLevelByAvailableHeightData(properties::BoolProperty("limitLevelByAvailableHeightData", "limitLevelByAvailableHeightData", true))
{
setName("RenderableGlobe");
@@ -91,6 +92,7 @@ namespace openspace {
addProperty(atmosphereEnabled);
addProperty(showChunkEdges);
addProperty(levelByProjArea);
addProperty(limitLevelByAvailableHeightData);
doFrustumCulling.setValue(true);
doHorizonCulling.setValue(true);
@@ -209,6 +211,7 @@ namespace openspace {
_chunkedLodGlobe->atmosphereEnabled = atmosphereEnabled.value();
_chunkedLodGlobe->showChunkEdges = showChunkEdges.value();
_chunkedLodGlobe->levelByProjArea = levelByProjArea.value();
_chunkedLodGlobe->limitLevelByAvailableHeightData = limitLevelByAvailableHeightData.value();
std::vector<TileProviderManager::TileProviderWithName>& colorTextureProviders =
_tileProviderManager->getLayerCategory(LayeredTextures::ColorTextures);

View File

@@ -86,6 +86,7 @@ public:
properties::BoolProperty atmosphereEnabled;
properties::BoolProperty showChunkEdges;
properties::BoolProperty levelByProjArea;
properties::BoolProperty limitLevelByAvailableHeightData;
private:
std::string _frame;

View File

@@ -71,7 +71,7 @@ namespace openspace {
template<typename KeyType, typename ValueType>
ValueType LRUCache<KeyType, ValueType>::get(const KeyType& key)
{
ghoul_assert(exist(key), "Key " << key << " must exist");
//ghoul_assert(exist(key), "Key " << key << " must exist");
auto it = _itemMap.find(key);
// Move list iterator pointing to value
_itemList.splice(_itemList.begin(), _itemList, it->second);

View File

@@ -129,10 +129,14 @@ namespace openspace {
HashKey key = chunkIndex.hashKey();
if (_tileCache->exist(key) && _tileCache->get(key).status == Tile::Status::OK) {
return { _tileCache->get(key), uvTransform };
if (_tileCache->exist(key)) {
auto tile = _tileCache->get(key);
if (tile.status == Tile::Status::OK) {
return{ _tileCache->get(key), uvTransform };
}
}
else if (chunkIndex.level < 1) {
if (chunkIndex.level < 1) {
return{ Tile::TileUnavailable, uvTransform };
}
else {