Cleanup Node
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "Drawable.hpp"
|
||||
#include "Scene.hpp"
|
||||
|
||||
@@ -9,8 +15,10 @@ namespace openVulkanoCpp
|
||||
{
|
||||
if (this->scene == scene) return;
|
||||
if (scene && this->scene) throw std::runtime_error("Drawable has been associated with a scene already!");
|
||||
const auto oldScene = this->scene;
|
||||
this->scene = scene;
|
||||
if(scene) scene->RegisterDrawable(this);
|
||||
else if (oldScene) oldScene->RemoveDrawable(this);
|
||||
}
|
||||
|
||||
void Drawable::RemoveNode(Node* node)
|
||||
|
||||
Reference in New Issue
Block a user