mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-07 20:09:58 -05:00
Merge branch 'feature/iSWA' of github.com:OpenSpace/OpenSpace-Development into feature/iSWA
This commit is contained in:
+1
-1
Submodule ext/ghoul updated: 9b822d0133...027ce0d585
@@ -149,7 +149,7 @@ else (WIN32)
|
||||
target_include_directories(
|
||||
openspace-module-globebrowsing
|
||||
SYSTEM PUBLIC
|
||||
${GDAL_INCLUDE}
|
||||
${GDAL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace openspace {
|
||||
_owner = newOwner;
|
||||
}
|
||||
|
||||
Chunk::Status Chunk::update(const RenderData& data) {
|
||||
Chunk::State Chunk::update(const RenderData& data) {
|
||||
auto savedCamera = _owner->getSavedCamera();
|
||||
const Camera& camRef = savedCamera != nullptr ? *savedCamera : data.camera;
|
||||
RenderData myRenderData = { camRef, data.position, data.doPerformanceMeasurement };
|
||||
@@ -82,14 +82,14 @@ namespace openspace {
|
||||
_isVisible = true;
|
||||
if (_owner->testIfCullable(*this, myRenderData)) {
|
||||
_isVisible = false;
|
||||
return Status::WANT_MERGE;
|
||||
return State::WANT_MERGE;
|
||||
}
|
||||
|
||||
int desiredLevel = _owner->getDesiredLevel(*this, myRenderData);
|
||||
|
||||
if (desiredLevel < _index.level) return Status::WANT_MERGE;
|
||||
else if (_index.level < desiredLevel) return Status::WANT_SPLIT;
|
||||
else return Status::DO_NOTHING;
|
||||
if (desiredLevel < _index.level) return State::WANT_MERGE;
|
||||
else if (_index.level < desiredLevel) return State::WANT_SPLIT;
|
||||
else return State::DO_NOTHING;
|
||||
}
|
||||
|
||||
Chunk::BoundingHeights Chunk::getBoundingHeights() const {
|
||||
@@ -104,7 +104,7 @@ namespace openspace {
|
||||
auto heightMapProviders = tileProvidermanager->getActivatedLayerCategory(LayeredTextures::HeightMaps);
|
||||
if (heightMapProviders.size() > 0) {
|
||||
TileAndTransform tileAndTransform = TileSelector::getHighestResolutionTile(heightMapProviders[0].get(), _index);
|
||||
if (tileAndTransform.tile.status == Tile::Status::OK) {
|
||||
if (tileAndTransform.tile.status == Tile::State::OK) {
|
||||
std::shared_ptr<TilePreprocessData> preprocessData = tileAndTransform.tile.preprocessData;
|
||||
if ((preprocessData != nullptr) && preprocessData->maxValues.size() > 0) {
|
||||
boundingHeights.max = preprocessData->maxValues[0];
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace openspace {
|
||||
bool available;
|
||||
};
|
||||
|
||||
enum class Status {
|
||||
enum class State {
|
||||
DO_NOTHING,
|
||||
WANT_MERGE,
|
||||
WANT_SPLIT,
|
||||
@@ -59,7 +59,7 @@ namespace openspace {
|
||||
Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex, bool initVisible = true);
|
||||
|
||||
/// Updates chunk internally and returns a desired level
|
||||
Status update(const RenderData& data);
|
||||
State update(const RenderData& data);
|
||||
|
||||
std::vector<glm::dvec4> getBoundingPolyhedronCorners() const;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <glm/glm.hpp>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -154,8 +154,8 @@ namespace openspace {
|
||||
|
||||
// simply check the first heigtmap
|
||||
if (heightMapProviders.size() > 0) {
|
||||
Tile::Status heightTileStatus = heightMapProviders[0]->getTileStatus(chunk.index());
|
||||
if (heightTileStatus == Tile::Status::IOError || heightTileStatus == Tile::Status::OutOfRange) {
|
||||
Tile::State heightTileStatus = heightMapProviders[0]->getTileStatus(chunk.index());
|
||||
if (heightTileStatus == Tile::State::IOError || heightTileStatus == Tile::State::OutOfRange) {
|
||||
return currLevel-1;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@ bool ChunkNode::updateChunkTree(const RenderData& data) {
|
||||
//LDEBUG("x: " << patch.x << " y: " << patch.y << " level: " << patch.level << " lat: " << center.lat << " lon: " << center.lon);
|
||||
|
||||
if (isLeaf()) {
|
||||
Chunk::Status status = _chunk.update(data);
|
||||
if (status == Chunk::Status::WANT_SPLIT) {
|
||||
Chunk::State status = _chunk.update(data);
|
||||
if (status == Chunk::State::WANT_SPLIT) {
|
||||
split();
|
||||
}
|
||||
return status == Chunk::Status::WANT_MERGE;
|
||||
return status == Chunk::State::WANT_MERGE;
|
||||
}
|
||||
else {
|
||||
char requestedMergeMask = 0;
|
||||
@@ -87,7 +87,7 @@ bool ChunkNode::updateChunkTree(const RenderData& data) {
|
||||
}
|
||||
|
||||
bool allChildrenWantsMerge = requestedMergeMask == 0xf;
|
||||
bool thisChunkWantsSplit = _chunk.update(data) == Chunk::Status::WANT_SPLIT;
|
||||
bool thisChunkWantsSplit = _chunk.update(data) == Chunk::State::WANT_SPLIT;
|
||||
|
||||
if (allChildrenWantsMerge && !thisChunkWantsSplit) {
|
||||
merge();
|
||||
@@ -192,7 +192,7 @@ void ChunkNode::split(int depth) {
|
||||
if (depth > 0 && isLeaf()) {
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
Chunk chunk(_chunk.owner(), _chunk.index().child((Quad)i));
|
||||
_children[i] = std::unique_ptr<ChunkNode>(new ChunkNode(chunk, this));
|
||||
_children[i] = std::make_unique<ChunkNode>(chunk, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace openspace {
|
||||
|
||||
// Get the texture that should be used for rendering
|
||||
TileAndTransform tileAndTransform = TileSelector::getHighestResolutionTile(tileProvider, chunkIndex);
|
||||
if (tileAndTransform.tile.status == Tile::Status::Unavailable) {
|
||||
if (tileAndTransform.tile.status == Tile::State::Unavailable) {
|
||||
// don't render if no tile was available
|
||||
programObject->deactivate();
|
||||
return nullptr;
|
||||
@@ -234,7 +234,7 @@ namespace openspace {
|
||||
// If blending is enabled, two more textures are needed
|
||||
if (layeredTexturePreprocessingData.layeredTextureInfo[category].layerBlendingEnabled) {
|
||||
TileAndTransform tileAndTransformParent1 = TileSelector::getHighestResolutionTile(tileProvider, chunkIndex, 1);
|
||||
if (tileAndTransformParent1.tile.status == Tile::Status::Unavailable) {
|
||||
if (tileAndTransformParent1.tile.status == Tile::State::Unavailable) {
|
||||
tileAndTransformParent1 = tileAndTransform;
|
||||
}
|
||||
activateTileAndSetTileUniforms(
|
||||
@@ -246,7 +246,7 @@ namespace openspace {
|
||||
tileAndTransformParent1);
|
||||
|
||||
TileAndTransform tileAndTransformParent2 = TileSelector::getHighestResolutionTile(tileProvider, chunkIndex, 2);
|
||||
if (tileAndTransformParent2.tile.status == Tile::Status::Unavailable) {
|
||||
if (tileAndTransformParent2.tile.status == Tile::State::Unavailable) {
|
||||
tileAndTransformParent2 = tileAndTransformParent1;
|
||||
}
|
||||
activateTileAndSetTileUniforms(
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace openspace {
|
||||
if (o.contains(*this)) return AABBSpatialRelation::Contained;
|
||||
return AABBSpatialRelation::Intersecting;
|
||||
}
|
||||
return AABBSpatialRelation::None;
|
||||
return AABBSpatialRelation::NoRelation;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace openspace {
|
||||
if (o.contains(*this)) return AABBSpatialRelation::Contained;
|
||||
return AABBSpatialRelation::Intersecting;
|
||||
}
|
||||
return AABBSpatialRelation::None;
|
||||
return AABBSpatialRelation::NoRelation;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace openspace {
|
||||
if (o.contains(*this)) return AABBSpatialRelation::Contained;
|
||||
return AABBSpatialRelation::Intersecting;
|
||||
}
|
||||
return AABBSpatialRelation::None;
|
||||
return AABBSpatialRelation::NoRelation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace openspace {
|
||||
const auto& tile = tileAndTransform.tile;
|
||||
const auto& uvTransform = tileAndTransform.uvTransform;
|
||||
const auto& depthTransform = tileProvider->depthTransform();
|
||||
if (tile.status != Tile::Status::OK) {
|
||||
if (tile.status != Tile::State::OK) {
|
||||
return 0;
|
||||
}
|
||||
glm::vec2 transformedUv = uvTransform.uvOffset + uvTransform.uvScale * patchUV;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace opengl {
|
||||
namespace openspace {
|
||||
|
||||
struct ReferencedBoolSelection : public properties::SelectionProperty {
|
||||
ReferencedBoolSelection::ReferencedBoolSelection(const std::string& identifier, const std::string& guiName)
|
||||
ReferencedBoolSelection(const std::string& identifier, const std::string& guiName)
|
||||
: properties::SelectionProperty(identifier, guiName) { }
|
||||
|
||||
void addOption(const std::string& name, bool* ref) {
|
||||
|
||||
@@ -43,11 +43,11 @@ BasicGrid::BasicGrid(
|
||||
useTextureCoordinates,
|
||||
useNormals)
|
||||
{
|
||||
_geometry = std::unique_ptr<TriangleSoup>(new TriangleSoup(
|
||||
_geometry = std::make_unique<TriangleSoup>(
|
||||
CreateElements(xSegments, ySegments),
|
||||
usePositions,
|
||||
useTextureCoordinates,
|
||||
useNormals));
|
||||
useNormals);
|
||||
|
||||
if (usePositions == TriangleSoup::Positions::Yes) {
|
||||
_geometry->setVertexPositions(CreatePositions(_xSegments, _ySegments));
|
||||
|
||||
@@ -66,11 +66,11 @@ int ClipMapGrid::segments() const {
|
||||
OuterClipMapGrid::OuterClipMapGrid(unsigned int segments)
|
||||
: ClipMapGrid(segments)
|
||||
{
|
||||
_geometry = std::unique_ptr<TriangleSoup>(new TriangleSoup(
|
||||
_geometry = std::make_unique<TriangleSoup>(
|
||||
CreateElements(segments, segments),
|
||||
TriangleSoup::Positions::No,
|
||||
TriangleSoup::TextureCoordinates::Yes,
|
||||
TriangleSoup::Normals::No));
|
||||
TriangleSoup::Normals::No);
|
||||
|
||||
_geometry->setVertexTextureCoordinates(CreateTextureCoordinates(segments, segments));
|
||||
}
|
||||
@@ -323,11 +323,11 @@ std::vector<glm::vec3> OuterClipMapGrid::CreateNormals(int xRes, int yRes) {
|
||||
InnerClipMapGrid::InnerClipMapGrid(unsigned int segments)
|
||||
: ClipMapGrid(segments)
|
||||
{
|
||||
_geometry = std::unique_ptr<TriangleSoup>(new TriangleSoup(
|
||||
_geometry = std::make_unique<TriangleSoup>(
|
||||
CreateElements(segments, segments),
|
||||
TriangleSoup::Positions::No,
|
||||
TriangleSoup::TextureCoordinates::Yes,
|
||||
TriangleSoup::Normals::No));
|
||||
TriangleSoup::Normals::No);
|
||||
|
||||
_geometry->setVertexTextureCoordinates(CreateTextureCoordinates(segments, segments));
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@ namespace openspace {
|
||||
useTextureCoordinates,
|
||||
useNormals)
|
||||
{
|
||||
_geometry = std::unique_ptr<TriangleSoup>(new TriangleSoup(
|
||||
_geometry = std::make_unique<TriangleSoup>(
|
||||
CreateElements(xSegments, ySegments),
|
||||
usePositions,
|
||||
useTextureCoordinates,
|
||||
useNormals));
|
||||
useNormals);
|
||||
|
||||
if (usePositions == TriangleSoup::Positions::Yes) {
|
||||
_geometry->setVertexPositions(CreatePositions(_xSegments, _ySegments));
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace openspace {
|
||||
return _currentTileProvider->depthTransform();
|
||||
}
|
||||
|
||||
Tile::Status TemporalTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
|
||||
Tile::State TemporalTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
|
||||
if (_currentTileProvider == nullptr) {
|
||||
LDEBUG("Warning: had to call update from getTileStatus()");
|
||||
update();
|
||||
@@ -234,8 +234,10 @@ namespace openspace {
|
||||
std::unordered_map<std::string, std::unique_ptr<TimeFormat>> TimeIdProviderFactory::_timeIdProviderMap = std::unordered_map<std::string, std::unique_ptr<TimeFormat>>();
|
||||
|
||||
void TimeIdProviderFactory::init() {
|
||||
_timeIdProviderMap.insert({ "YYYY-MM-DD", std::make_unique<YYYY_MM_DD>() });
|
||||
_timeIdProviderMap.insert({ "YYYY-MM-DDThh:mm:ssZ", std::make_unique<YYYY_MM_DDThh_mm_ssZ>() });
|
||||
|
||||
|
||||
_timeIdProviderMap.insert(std::make_pair("YYYY-MM-DD", std::make_unique<YYYY_MM_DD>()));
|
||||
_timeIdProviderMap.insert(std::make_pair("YYYY-MM-DDThh:mm:ssZ", std::make_unique<YYYY_MM_DDThh_mm_ssZ>()));
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "gdal_priv.h"
|
||||
#include <gdal_priv.h>
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace openspace {
|
||||
|
||||
// These methods implements TileProvider
|
||||
virtual Tile getTile(const ChunkIndex& chunkIndex);
|
||||
virtual Tile::Status getTileStatus(const ChunkIndex& chunkIndex);
|
||||
virtual Tile::State getTileStatus(const ChunkIndex& chunkIndex);
|
||||
virtual TileDepthTransform depthTransform();
|
||||
virtual void update();
|
||||
virtual std::shared_ptr<AsyncTileDataProvider> getAsyncTileReader();
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace openspace {
|
||||
|
||||
std::shared_ptr<TileIOResult> get(const ChunkIndex& chunkIndex);
|
||||
bool has(const ChunkIndex& chunkIndex) const;
|
||||
bool TileDiskCache::put(const ChunkIndex& chunkIndex, std::shared_ptr<TileIOResult> tileIOResult);
|
||||
bool put(const ChunkIndex& chunkIndex, std::shared_ptr<TileIOResult> tileIOResult);
|
||||
|
||||
|
||||
static const std::string CACHE_ROOT;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
const Tile Tile::TileUnavailable = {nullptr, nullptr, Tile::Status::Unavailable };
|
||||
const Tile Tile::TileUnavailable = {nullptr, nullptr, Tile::State::Unavailable };
|
||||
|
||||
CachingTileProvider::CachingTileProvider(std::shared_ptr<AsyncTileDataProvider> tileReader,
|
||||
std::shared_ptr<TileCache> tileCache,
|
||||
@@ -84,7 +84,7 @@ namespace openspace {
|
||||
|
||||
auto tileDataset = _asyncTextureDataProvider->getTextureDataProvider();
|
||||
if (chunkIndex.level > tileDataset->getMaximumLevel()) {
|
||||
tile.status = Tile::Status::OutOfRange;
|
||||
tile.status = Tile::State::OutOfRange;
|
||||
return tile;
|
||||
}
|
||||
|
||||
@@ -112,10 +112,10 @@ namespace openspace {
|
||||
_framesSinceLastRequestFlush = 0;
|
||||
}
|
||||
|
||||
Tile::Status CachingTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
|
||||
Tile::State CachingTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
|
||||
auto tileDataset = _asyncTextureDataProvider->getTextureDataProvider();
|
||||
if (chunkIndex.level > tileDataset->getMaximumLevel()) {
|
||||
return Tile::Status::OutOfRange;
|
||||
return Tile::State::OutOfRange;
|
||||
}
|
||||
|
||||
ChunkHashKey key = chunkIndex.hashKey();
|
||||
@@ -124,7 +124,7 @@ namespace openspace {
|
||||
return _tileCache->get(key).status;
|
||||
}
|
||||
|
||||
return Tile::Status::Unavailable;
|
||||
return Tile::State::Unavailable;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace openspace {
|
||||
Tile tile = {
|
||||
texture,
|
||||
tileIOResult->preprocessData,
|
||||
tileIOResult->error == CE_None ? Tile::Status::OK : Tile::Status::IOError
|
||||
tileIOResult->error == CE_None ? Tile::State::OK : Tile::State::IOError
|
||||
};
|
||||
|
||||
_tileCache->put(key, tile);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace openspace {
|
||||
std::shared_ptr<Texture> texture;
|
||||
std::shared_ptr<TilePreprocessData> preprocessData;
|
||||
|
||||
enum class Status { Unavailable, OutOfRange, IOError, OK } status;
|
||||
enum class State { Unavailable, OutOfRange, IOError, OK } status;
|
||||
|
||||
static const Tile TileUnavailable;
|
||||
};
|
||||
@@ -68,7 +68,7 @@ namespace openspace {
|
||||
virtual ~TileProvider() { }
|
||||
|
||||
virtual Tile getTile(const ChunkIndex& chunkIndex) = 0;
|
||||
virtual Tile::Status getTileStatus(const ChunkIndex& index) = 0;
|
||||
virtual Tile::State getTileStatus(const ChunkIndex& index) = 0;
|
||||
virtual TileDepthTransform depthTransform() = 0;
|
||||
virtual void update() = 0;
|
||||
virtual std::shared_ptr<AsyncTileDataProvider> getAsyncTileReader() = 0;
|
||||
@@ -94,7 +94,7 @@ namespace openspace {
|
||||
virtual ~CachingTileProvider();
|
||||
|
||||
virtual Tile getTile(const ChunkIndex& chunkIndex);
|
||||
virtual Tile::Status getTileStatus(const ChunkIndex& index);
|
||||
virtual Tile::State getTileStatus(const ChunkIndex& index);
|
||||
virtual TileDepthTransform depthTransform();
|
||||
virtual void update();
|
||||
virtual std::shared_ptr<AsyncTileDataProvider> getAsyncTileReader();
|
||||
|
||||
@@ -156,8 +156,8 @@ namespace openspace {
|
||||
// for (auto tileProviderWithName : layerCategory) {
|
||||
// =======
|
||||
void TileProviderManager::update() {
|
||||
for each (auto layerCategory in _layerCategories) {
|
||||
for each (auto tileProviderWithName in layerCategory) {
|
||||
for (auto layerCategory : _layerCategories) {
|
||||
for (auto tileProviderWithName : layerCategory) {
|
||||
// >>>>>>> feature/globebrowsing:modules/globebrowsing/tile/TileProviderManager.cpp
|
||||
if (tileProviderWithName.isActive) {
|
||||
tileProviderWithName.tileProvider->update();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace openspace {
|
||||
// has a loaded tile ready to use.
|
||||
while (chunkIndex.level > 1) {
|
||||
Tile tile = tileProvider->getTile(chunkIndex);
|
||||
if (tile.status != Tile::Status::OK) {
|
||||
if (tile.status != Tile::State::OK) {
|
||||
ascendToParent(chunkIndex, uvTransform);
|
||||
}
|
||||
else return { tile, uvTransform };
|
||||
|
||||
Reference in New Issue
Block a user