Create SceneGraphNodes in memory pool

This commit is contained in:
Alexander Bock
2020-08-05 10:46:16 +02:00
parent e783807d66
commit 25247c7a37
7 changed files with 35 additions and 25 deletions
+2 -2
View File
@@ -81,12 +81,12 @@ public:
/**
* Attach node to the root
*/
void attachNode(std::unique_ptr<SceneGraphNode> node);
void attachNode(ghoul::mm_unique_ptr<SceneGraphNode> node);
/**
* Detach node from the root
*/
std::unique_ptr<SceneGraphNode> detachNode(SceneGraphNode& node);
ghoul::mm_unique_ptr<SceneGraphNode> detachNode(SceneGraphNode& node);
/**
* Set the camera of the scene
+5 -4
View File
@@ -34,6 +34,7 @@
#include <openspace/properties/vector/ivec2property.h>
#include <ghoul/glm.h>
#include <ghoul/misc/boolean.h>
#include <ghoul/misc/managedmemoryuniqueptr.h>
#include <atomic>
#include <functional>
#include <memory>
@@ -88,7 +89,7 @@ public:
SceneGraphNode();
~SceneGraphNode();
static std::unique_ptr<SceneGraphNode> createFromDictionary(
static ghoul::mm_unique_ptr<SceneGraphNode> createFromDictionary(
const ghoul::Dictionary& dictionary);
void initialize();
@@ -101,8 +102,8 @@ public:
void update(const UpdateData& data);
void render(const RenderData& data, RendererTasks& tasks);
void attachChild(std::unique_ptr<SceneGraphNode> child);
std::unique_ptr<SceneGraphNode> detachChild(SceneGraphNode& child);
void attachChild(ghoul::mm_unique_ptr<SceneGraphNode> child);
ghoul::mm_unique_ptr<SceneGraphNode> detachChild(SceneGraphNode& child);
void clearChildren();
void setParent(SceneGraphNode& parent);
@@ -156,7 +157,7 @@ private:
void computeScreenSpaceData(RenderData& newData);
std::atomic<State> _state = State::Loaded;
std::vector<std::unique_ptr<SceneGraphNode>> _children;
std::vector<ghoul::mm_unique_ptr<SceneGraphNode>> _children;
SceneGraphNode* _parent = nullptr;
std::vector<SceneGraphNode*> _dependencies;
std::vector<SceneGraphNode*> _dependentNodes;
+1 -1
View File
@@ -31,7 +31,7 @@ namespace openspace {
class MemoryManager {
public:
ghoul::MemoryPool<10 * 1024, false> PersistentMemory;
ghoul::MemoryPool<2 * 1024 * 1024, false> PersistentMemory;
ghoul::MemoryPool<10 * 1024, false> TemporaryMemory;
};