From e783807d666683b82c64890f0fd5de6ff5782b46 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 4 Aug 2020 21:56:39 +0200 Subject: [PATCH] Next step towards enabling a managed memory version of templatefactory --- ext/ghoul | 2 +- include/openspace/engine/globals.h | 3 + include/openspace/scene/scene.h | 3 + include/openspace/util/memorymanager.h | 40 +++++++++++ modules/base/rendering/modelgeometry.cpp | 3 +- modules/globebrowsing/src/tileprovider.cpp | 4 +- modules/imgui/CMakeLists.txt | 2 + modules/imgui/include/gui.h | 5 +- modules/imgui/include/guimemorycomponent.h | 41 ++++++++++++ modules/imgui/src/guimemorycomponent.cpp | 67 +++++++++++++++++++ modules/server/src/connection.cpp | 2 +- modules/space/rendering/planetgeometry.cpp | 4 +- .../spacecraftinstruments/util/decoder.cpp | 4 +- src/CMakeLists.txt | 1 + src/engine/globals.cpp | 8 ++- src/rendering/dashboarditem.cpp | 3 +- src/rendering/renderable.cpp | 10 ++- src/rendering/screenspacerenderable.cpp | 10 +-- src/scene/lightsource.cpp | 8 +-- src/scene/rotation.cpp | 10 ++- src/scene/scale.cpp | 10 ++- src/scene/scenegraphnode.cpp | 21 ++++-- src/scene/timeframe.cpp | 10 ++- src/scene/translation.cpp | 10 ++- src/util/resourcesynchronization.cpp | 3 +- src/util/task.cpp | 4 +- 26 files changed, 251 insertions(+), 37 deletions(-) create mode 100644 include/openspace/util/memorymanager.h create mode 100644 modules/imgui/include/guimemorycomponent.h create mode 100644 modules/imgui/src/guimemorycomponent.cpp diff --git a/ext/ghoul b/ext/ghoul index 2081cc59d5..0b95f58648 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 2081cc59d5a5cf59d679e7363ea42c8cee19078a +Subproject commit 0b95f586481a655fe6c2e3f7040bea78849d2af0 diff --git a/include/openspace/engine/globals.h b/include/openspace/engine/globals.h index 0bf76957f5..87d8c3f844 100644 --- a/include/openspace/engine/globals.h +++ b/include/openspace/engine/globals.h @@ -37,6 +37,7 @@ class Dashboard; class DeferredcasterManager; class DownloadManager; class LuaConsole; +class MemoryManager; class MissionManager; class ModuleEngine; class OpenSpaceEngine; @@ -76,6 +77,7 @@ Dashboard& gDashboard(); DeferredcasterManager& gDeferredcasterManager(); DownloadManager& gDownloadManager(); LuaConsole& gLuaConsole(); +MemoryManager& gMemoryManager(); MissionManager& gMissionManager(); ModuleEngine& gModuleEngine(); OpenSpaceEngine& gOpenSpaceEngine(); @@ -110,6 +112,7 @@ static Dashboard& dashboard = detail::gDashboard(); static DeferredcasterManager& deferredcasterManager = detail::gDeferredcasterManager(); static DownloadManager& downloadManager = detail::gDownloadManager(); static LuaConsole& luaConsole = detail::gLuaConsole(); +static MemoryManager& memoryManager = detail::gMemoryManager(); static MissionManager& missionManager = detail::gMissionManager(); static ModuleEngine& moduleEngine = detail::gModuleEngine(); static OpenSpaceEngine& openSpaceEngine = detail::gOpenSpaceEngine(); diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 8a19bbfbe2..8458d33ec3 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -262,6 +263,8 @@ private: bool isExpired = false; }; std::vector _propertyInterpolationInfos; + + ghoul::MemoryPool<4096> _memoryPool; }; } // namespace openspace diff --git a/include/openspace/util/memorymanager.h b/include/openspace/util/memorymanager.h new file mode 100644 index 0000000000..bf455be04d --- /dev/null +++ b/include/openspace/util/memorymanager.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2020 * + * * + * 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 __OPENSPACE_CORE___MEMORYMANAGER___H__ +#define __OPENSPACE_CORE___MEMORYMANAGER___H__ + +#include + +namespace openspace { + +class MemoryManager { +public: + ghoul::MemoryPool<10 * 1024, false> PersistentMemory; + ghoul::MemoryPool<10 * 1024, false> TemporaryMemory; +}; + +} // namespace openspace + +#endif // __OPENSPACE_CORE___MEMORYMANAGER___H__ diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp index 1fee2ed0cd..d597230d9f 100644 --- a/modules/base/rendering/modelgeometry.cpp +++ b/modules/base/rendering/modelgeometry.cpp @@ -81,7 +81,8 @@ std::unique_ptr ModelGeometry::createFromDictionary( const std::string& geometryType = dictionary.value(KeyType); auto factory = FactoryManager::ref().factory(); - return factory->create(geometryType, dictionary);; + ModelGeometry* geometry = factory->create(geometryType, dictionary); + return std::unique_ptr(geometry); } ModelGeometry::ModelGeometry(const ghoul::Dictionary& dictionary) diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index d79aaca8a4..707731f83b 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -519,8 +519,8 @@ std::unique_ptr createFromDictionary(layergroupid::TypeID layerTyp const char* type = layergroupid::LAYER_TYPE_NAMES[static_cast(layerTypeID)]; auto factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(type, dictionary); - return result; + TileProvider* result = factory->create(type, dictionary); + return std::unique_ptr(result); } TileProvider::TileProvider() : properties::PropertyOwner({ "tileProvider" }) {} diff --git a/modules/imgui/CMakeLists.txt b/modules/imgui/CMakeLists.txt index 0e043a9479..73e0fdb166 100644 --- a/modules/imgui/CMakeLists.txt +++ b/modules/imgui/CMakeLists.txt @@ -34,6 +34,7 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/guiglobebrowsingcomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guihelpcomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guijoystickcomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guimemorycomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guimissioncomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guiperformancecomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guiparallelcomponent.h @@ -54,6 +55,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/guiglobebrowsingcomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guihelpcomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guijoystickcomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guimemorycomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guimissioncomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guiperformancecomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guiparallelcomponent.cpp diff --git a/modules/imgui/include/gui.h b/modules/imgui/include/gui.h index e428631d89..a3cd36240f 100644 --- a/modules/imgui/include/gui.h +++ b/modules/imgui/include/gui.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,7 @@ namespace openspace::gui { namespace detail { constexpr int nComponents() { - const int nRegularComponents = 16; + const int nRegularComponents = 17; int totalComponents = nRegularComponents; #ifdef OPENSPACE_MODULE_ISWA_ENABLED @@ -112,6 +113,7 @@ public: GuiPropertyComponent _sceneProperty; GuiPropertyComponent _screenSpaceProperty; GuiPropertyComponent _moduleProperty; + GuiMemoryComponent _memoryComponent; GuiPropertyComponent _virtualProperty; GuiSpaceTimeComponent _spaceTime; @@ -139,6 +141,7 @@ private: &_virtualProperty, &_globalProperty, &_moduleProperty, + &_memoryComponent, &_spaceTime, &_mission, diff --git a/modules/imgui/include/guimemorycomponent.h b/modules/imgui/include/guimemorycomponent.h new file mode 100644 index 0000000000..8f08bec8db --- /dev/null +++ b/modules/imgui/include/guimemorycomponent.h @@ -0,0 +1,41 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2020 * + * * + * 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 __OPENSPACE_MODULE_IMGUI___GUIMEMORYCOMPONENT___H__ +#define __OPENSPACE_MODULE_IMGUI___GUIMEMORYCOMPONENT___H__ + +#include + +namespace openspace::gui { + +class GuiMemoryComponent : public GuiComponent { +public: + GuiMemoryComponent(); + + void render() override; +}; + +} // namespace openspace::gui + +#endif // __OPENSPACE_MODULE_IMGUI___GUIMEMORYCOMPONENT___H__ diff --git a/modules/imgui/src/guimemorycomponent.cpp b/modules/imgui/src/guimemorycomponent.cpp new file mode 100644 index 0000000000..5d1192aef6 --- /dev/null +++ b/modules/imgui/src/guimemorycomponent.cpp @@ -0,0 +1,67 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2020 * + * * + * 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 + +#include +#include +#include + +namespace { + const ImVec2 Size = ImVec2(350, 500); + + template + void renderMemoryPoolInformation(const MemoryPool& p) { + //ImGui::Text("Bucket Size: %i", p.BucketSize); + ImGui::Text("Number of Buckets: %i", p.nBuckets()); + const std::vector& occupancies = p.occupancies(); + for (size_t i = 0; i < occupancies.size(); ++i) { + ImGui::Text(" %i: %i/%i", i, occupancies[i], p.BucketSize); + } + } +} // namespace + +namespace openspace::gui { + +GuiMemoryComponent::GuiMemoryComponent() + : GuiComponent("memory_information", "Memory Information") +{} + +void GuiMemoryComponent::render() { + ImGui::SetNextWindowCollapsed(_isCollapsed); + + bool v = _isEnabled; + ImGui::Begin("Memory Information", &v, Size, 0.5f); + _isEnabled = v; + _isCollapsed = ImGui::IsWindowCollapsed(); + + ImGui::Text("%s", "Persistent Memory Pool"); + renderMemoryPoolInformation(global::memoryManager.PersistentMemory); + + ImGui::Text("%s", "Temporary Memory Pool"); + renderMemoryPoolInformation(global::memoryManager.TemporaryMemory); + ImGui::End(); +} + +} // namespace openspace::gui diff --git a/modules/server/src/connection.cpp b/modules/server/src/connection.cpp index 43b9f3d82e..89cb02a96c 100644 --- a/modules/server/src/connection.cpp +++ b/modules/server/src/connection.cpp @@ -184,7 +184,7 @@ void Connection::handleJson(const nlohmann::json& json) { return; } - std::unique_ptr topic = _topicFactory.create(type); + std::unique_ptr topic = std::unique_ptr(_topicFactory.create(type)); topic->initialize(this, topicId); topic->handleJson(*payloadJson); if (!topic->isDone()) { diff --git a/modules/space/rendering/planetgeometry.cpp b/modules/space/rendering/planetgeometry.cpp index 5a5a782015..12410506bd 100644 --- a/modules/space/rendering/planetgeometry.cpp +++ b/modules/space/rendering/planetgeometry.cpp @@ -63,8 +63,8 @@ std::unique_ptr PlanetGeometry::createFromDictionary( std::string geometryType = dictionary.value(KeyType); auto factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(geometryType, dictionary); - return result; + PlanetGeometry* result = factory->create(geometryType, dictionary); + return std::unique_ptr(result); } PlanetGeometry::PlanetGeometry() : properties::PropertyOwner({ "PlanetGeometry" }) {} diff --git a/modules/spacecraftinstruments/util/decoder.cpp b/modules/spacecraftinstruments/util/decoder.cpp index 1006d856d4..64a6344a04 100644 --- a/modules/spacecraftinstruments/util/decoder.cpp +++ b/modules/spacecraftinstruments/util/decoder.cpp @@ -36,8 +36,8 @@ std::unique_ptr Decoder::createFromDictionary( const std::string& type) { ghoul::TemplateFactory* factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(type, dictionary); - return result; + Decoder* result = factory->create(type, dictionary); + return std::unique_ptr(result); } } // namespace openspace diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3ea989bb7b..8eb1c6062a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -370,6 +370,7 @@ set(OPENSPACE_HEADER ${OPENSPACE_BASE_DIR}/include/openspace/util/httprequest.h ${OPENSPACE_BASE_DIR}/include/openspace/util/job.h ${OPENSPACE_BASE_DIR}/include/openspace/util/keys.h + ${OPENSPACE_BASE_DIR}/include/openspace/util/memorymanager.h ${OPENSPACE_BASE_DIR}/include/openspace/util/mouse.h ${OPENSPACE_BASE_DIR}/include/openspace/util/openspacemodule.h ${OPENSPACE_BASE_DIR}/include/openspace/util/progressbar.h diff --git a/src/engine/globals.cpp b/src/engine/globals.cpp index 34effc2cc5..e6970e2a55 100644 --- a/src/engine/globals.cpp +++ b/src/engine/globals.cpp @@ -51,8 +51,9 @@ #include #include #include -#include +#include #include +#include #include #include #include @@ -88,6 +89,11 @@ LuaConsole& gLuaConsole() { return g; } +MemoryManager& gMemoryManager() { + static MemoryManager g; + return g; +} + MissionManager& gMissionManager() { static MissionManager g; return g; diff --git a/src/rendering/dashboarditem.cpp b/src/rendering/dashboarditem.cpp index 6b807b909f..a075d500ed 100644 --- a/src/rendering/dashboarditem.cpp +++ b/src/rendering/dashboarditem.cpp @@ -95,7 +95,8 @@ std::unique_ptr DashboardItem::createFromDictionary( const std::string& dashboardType = dictionary.value(KeyType); - return factory->create(dashboardType, std::move(dictionary)); + DashboardItem* item = factory->create(dashboardType, std::move(dictionary)); + return std::unique_ptr(item); } DashboardItem::DashboardItem(const ghoul::Dictionary& dictionary) diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 5a6f50de0f..a74ca1147b 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -26,8 +26,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -107,8 +109,12 @@ std::unique_ptr Renderable::createFromDictionary( auto factory = FactoryManager::ref().factory(); ghoul_assert(factory, "Renderable factory did not exist"); - std::unique_ptr result = factory->create(renderableType, dictionary); - return result; + Renderable* result = factory->create( + renderableType, + dictionary/*, + &global::memoryManager.PersistentMemory*/ + ); + return std::unique_ptr(result); } diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index ed9b3fbbeb..49df254322 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -307,10 +307,12 @@ std::unique_ptr ScreenSpaceRenderable::createFromDictiona ); const std::string& renderableType = dictionary.value(KeyType); - return FactoryManager::ref().factory()->create( - renderableType, - dictionary - ); + ScreenSpaceRenderable* ssr = + FactoryManager::ref().factory()->create( + renderableType, + dictionary + ); + return std::unique_ptr(ssr); } std::string ScreenSpaceRenderable::makeUniqueIdentifier(std::string name) { diff --git a/src/scene/lightsource.cpp b/src/scene/lightsource.cpp index cee754cfec..be63cf1a30 100644 --- a/src/scene/lightsource.cpp +++ b/src/scene/lightsource.cpp @@ -91,12 +91,12 @@ std::unique_ptr LightSource::createFromDictionary( const std::string timeFrameType = dictionary.value(KeyType); auto factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(timeFrameType, dictionary); - + LightSource* source = factory->create(timeFrameType, dictionary); + const std::string identifier = dictionary.value(KeyIdentifier); - result->setIdentifier(identifier); + source->setIdentifier(identifier); - return result; + return std::unique_ptr(source); } LightSource::LightSource() diff --git a/src/scene/rotation.cpp b/src/scene/rotation.cpp index 9f0233ece7..7e184bf53b 100644 --- a/src/scene/rotation.cpp +++ b/src/scene/rotation.cpp @@ -26,7 +26,9 @@ #include #include +#include #include +#include #include #include #include @@ -66,8 +68,12 @@ std::unique_ptr Rotation::createFromDictionary( const std::string& rotationType = dictionary.value(KeyType); auto factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(rotationType, dictionary); - return result; + Rotation* result = factory->create( + rotationType, + dictionary/*, + &global::memoryManager.PersistentMemory*/ + ); + return std::unique_ptr(result); } Rotation::Rotation() : properties::PropertyOwner({ "Rotation" }) {} diff --git a/src/scene/scale.cpp b/src/scene/scale.cpp index d1eb8e59fc..d8fc7fdac4 100644 --- a/src/scene/scale.cpp +++ b/src/scene/scale.cpp @@ -26,7 +26,9 @@ #include #include +#include #include +#include #include #include #include @@ -64,9 +66,13 @@ std::unique_ptr Scale::createFromDictionary(const ghoul::Dictionary& dict std::string scaleType = dictionary.value(KeyType); auto factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(scaleType, dictionary); + Scale* result = factory->create( + scaleType, + dictionary/*, + &global::memoryManager.PersistentMemory*/ + ); result->setIdentifier("Scale"); - return result; + return std::unique_ptr(result); } Scale::Scale() : properties::PropertyOwner({ "Scale" }) {} diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index 14db241e45..3c9cffdd6e 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -144,7 +145,10 @@ std::unique_ptr SceneGraphNode::createFromDictionary( "SceneGraphNode" ); - std::unique_ptr result = std::make_unique(); + //SceneGraphNode* n = global::memoryManager.PersistentMemory.alloc(); + SceneGraphNode* n = new SceneGraphNode; + std::unique_ptr result = std::unique_ptr(n); + #ifdef Debugging_Core_SceneGraphNode_Indices result->index = nextIndex++; #endif // Debugging_Core_SceneGraphNode_Indices @@ -312,9 +316,18 @@ SceneGraphNode::SceneGraphNode() , _guiPath(GuiPathInfo) , _guiDisplayName(GuiNameInfo) , _transform { - std::make_unique(), - std::make_unique(), - std::make_unique() + std::unique_ptr( + new StaticTranslation + //global::memoryManager.PersistentMemory.alloc() + ), + std::unique_ptr( + new StaticRotation + //global::memoryManager.PersistentMemory.alloc() + ), + std::unique_ptr( + new StaticScale + //global::memoryManager.PersistentMemory.alloc() + ) } , _boundingSphere(properties::FloatProperty(BoundingSphereInfo, 0.f)) , _computeScreenSpaceValues(ComputeScreenSpaceInfo, false) diff --git a/src/scene/timeframe.cpp b/src/scene/timeframe.cpp index 5ac45d5d65..01282e18ca 100644 --- a/src/scene/timeframe.cpp +++ b/src/scene/timeframe.cpp @@ -26,7 +26,9 @@ #include #include +#include #include +#include #include #include #include @@ -66,9 +68,13 @@ std::unique_ptr TimeFrame::createFromDictionary( const std::string timeFrameType = dictionary.value(KeyType); auto factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(timeFrameType, dictionary); + TimeFrame* result = factory->create( + timeFrameType, + dictionary/*, + &global::memoryManager.PersistentMemory*/ + ); result->setIdentifier("TimeFrame"); - return result; + return std::unique_ptr(result); } TimeFrame::TimeFrame() : properties::PropertyOwner({ "TimeFrame" }) {} diff --git a/src/scene/translation.cpp b/src/scene/translation.cpp index 3e95735a8b..fdec079e68 100644 --- a/src/scene/translation.cpp +++ b/src/scene/translation.cpp @@ -25,7 +25,9 @@ #include #include +#include #include +#include #include #include @@ -66,9 +68,13 @@ std::unique_ptr Translation::createFromDictionary( const std::string& translationType = dictionary.value(KeyType); ghoul::TemplateFactory* factory = FactoryManager::ref().factory(); - std::unique_ptr result = factory->create(translationType, dictionary); + Translation* result = factory->create( + translationType, + dictionary/*, + &global::memoryManager.PersistentMemory*/ + ); result->setIdentifier("Translation"); - return result; + return std::unique_ptr(result); } Translation::Translation() : properties::PropertyOwner({ "Translation" }) {} diff --git a/src/util/resourcesynchronization.cpp b/src/util/resourcesynchronization.cpp index 7199b7a82a..0af28f3c18 100644 --- a/src/util/resourcesynchronization.cpp +++ b/src/util/resourcesynchronization.cpp @@ -78,7 +78,8 @@ std::unique_ptr ResourceSynchronization::createFromDict auto factory = FactoryManager::ref().factory(); ghoul_assert(factory, "ResourceSynchronization factory did not exist"); - return factory->create(synchronizationType, dictionary); + ResourceSynchronization* sync = factory->create(synchronizationType, dictionary); + return std::unique_ptr(sync); } ResourceSynchronization::ResourceSynchronization(const ghoul::Dictionary& dictionary) { diff --git a/src/util/task.cpp b/src/util/task.cpp index 81a3bce488..b6de0c29a7 100644 --- a/src/util/task.cpp +++ b/src/util/task.cpp @@ -61,8 +61,8 @@ std::unique_ptr Task::createFromDictionary(const ghoul::Dictionary& dictio std::string taskType = dictionary.value("Type"); auto factory = FactoryManager::ref().factory(); - std::unique_ptr task = factory->create(taskType, dictionary); - return task; + Task* task = factory->create(taskType, dictionary); + return std::unique_ptr(task); } } // namespace openspace