diff --git a/modules/globebrowsing/chunk/chunk.cpp b/modules/globebrowsing/chunk/chunk.cpp index 5fc7cbced6..3c76bafcde 100644 --- a/modules/globebrowsing/chunk/chunk.cpp +++ b/modules/globebrowsing/chunk/chunk.cpp @@ -74,7 +74,7 @@ namespace openspace { } Chunk::Status Chunk::update(const RenderData& data) { - Camera* savedCamera = _owner->getSavedCamera(); + auto savedCamera = _owner->getSavedCamera(); const Camera& camRef = savedCamera != nullptr ? *savedCamera : data.camera; RenderData myRenderData = { camRef, data.position, data.doPerformanceMeasurement }; diff --git a/modules/globebrowsing/chunk/chunkedlodglobe.cpp b/modules/globebrowsing/chunk/chunkedlodglobe.cpp index 4ac4af2c2f..228026f6c9 100644 --- a/modules/globebrowsing/chunk/chunkedlodglobe.cpp +++ b/modules/globebrowsing/chunk/chunkedlodglobe.cpp @@ -76,8 +76,8 @@ namespace openspace { TriangleSoup::TextureCoordinates::Yes, TriangleSoup::Normals::No); - _chunkCullers.push_back(new HorizonCuller()); - _chunkCullers.push_back(new FrustumCuller(AABB3(vec3(-1, -1, 0), vec3(1, 1, 1e35)))); + _chunkCullers.push_back(std::make_unique()); + _chunkCullers.push_back(std::make_unique(AABB3(vec3(-1, -1, 0), vec3(1, 1, 1e35)))); diff --git a/modules/globebrowsing/chunk/chunkedlodglobe.h b/modules/globebrowsing/chunk/chunkedlodglobe.h index c9d9190814..72ebad8063 100644 --- a/modules/globebrowsing/chunk/chunkedlodglobe.h +++ b/modules/globebrowsing/chunk/chunkedlodglobe.h @@ -92,9 +92,8 @@ namespace openspace { std::shared_ptr getTileProviderManager() const; - Camera* getSavedCamera() const { return _savedCamera; } - void setSaveCamera(Camera* c) { - if (_savedCamera != nullptr) delete _savedCamera; + const std::shared_ptr getSavedCamera() const { return _savedCamera; } + void setSaveCamera(std::shared_ptr c) { _savedCamera = c; } @@ -109,6 +108,7 @@ namespace openspace { // Layered rendering std::array blendProperties; + bool atmosphereEnabled; bool showChunkEdges = false; bool showChunkBounds = false; @@ -138,7 +138,7 @@ namespace openspace { static const ChunkIndex LEFT_HEMISPHERE_INDEX; static const ChunkIndex RIGHT_HEMISPHERE_INDEX; - std::vector _chunkCullers; + std::vector> _chunkCullers; std::unique_ptr _chunkEvaluatorByAvailableTiles; std::unique_ptr _chunkEvaluatorByProjectedArea; @@ -147,7 +147,7 @@ namespace openspace { const Ellipsoid& _ellipsoid; glm::dmat3 _stateMatrix; - Camera* _savedCamera; + std::shared_ptr _savedCamera; std::shared_ptr _tileProviderManager; }; diff --git a/modules/globebrowsing/globes/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp index d61bec1da8..4616a48d1f 100644 --- a/modules/globebrowsing/globes/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -101,12 +101,12 @@ namespace openspace { ghoul::Dictionary texturesDictionary; dictionary.getValue(keyTextureInitData, textureInitDataDictionary); dictionary.getValue(keyTextures, texturesDictionary); - _tileProviderManager = std::shared_ptr( - new TileProviderManager(texturesDictionary, textureInitDataDictionary)); - _chunkedLodGlobe = std::shared_ptr( - new ChunkedLodGlobe(_ellipsoid, patchSegments, _tileProviderManager)); + _tileProviderManager = std::make_shared( + texturesDictionary, textureInitDataDictionary); + _chunkedLodGlobe = std::make_shared( + _ellipsoid, patchSegments, _tileProviderManager); _distanceSwitch.addSwitchValue(_chunkedLodGlobe, 1e12); // Add debug options - must be after chunkedLodGlobe has been created as it @@ -122,14 +122,16 @@ namespace openspace { for (int i = 0; i < LayeredTextures::NUM_TEXTURE_CATEGORIES; i++){ LayeredTextures::TextureCategory category = (LayeredTextures::TextureCategory) i; std::string categoryName = std::to_string(i+1) + ". " + LayeredTextures::TEXTURE_CATEGORY_NAMES[i]; - ReferencedBoolSelection* selection = new ReferencedBoolSelection(categoryName, categoryName); - _categorySelections.push_back(selection); - addProperty(selection); + auto selection = std::make_unique(categoryName, categoryName); + auto& categoryProviders = _tileProviderManager->getLayerCategory(category); for (auto& provider : categoryProviders) { selection->addOption(provider.name, &provider.isActive); } selection->addOption(" - Blend tile levels - ", &_chunkedLodGlobe->blendProperties[category]); + + addProperty(selection.get()); + _categorySelections.push_back(std::move(selection)); } } @@ -160,7 +162,7 @@ namespace openspace { if (_chunkedLodGlobe->getSavedCamera() == nullptr) { // save camera LDEBUG("Saving snapshot of camera!"); - _chunkedLodGlobe->setSaveCamera(new Camera(data.camera)); + _chunkedLodGlobe->setSaveCamera(std::make_shared(data.camera)); } else { // throw camera LDEBUG("Throwing away saved camera!"); diff --git a/modules/globebrowsing/globes/renderableglobe.h b/modules/globebrowsing/globes/renderableglobe.h index 9973405050..d915bdf890 100644 --- a/modules/globebrowsing/globes/renderableglobe.h +++ b/modules/globebrowsing/globes/renderableglobe.h @@ -122,7 +122,7 @@ public: properties::FloatProperty chunkHeight; - std::vector _categorySelections; + std::vector> _categorySelections; properties::BoolProperty atmosphereEnabled;