Files
OpenVulkano/openVulkanoCpp/Scene/Drawable.cpp
2019-10-14 23:02:51 +02:00

26 lines
525 B
C++

#include "Drawable.hpp"
#include "Scene.hpp"
namespace openVulkanoCpp
{
namespace Scene
{
void Drawable::SetScene(Scene* scene)
{
if (this->scene == scene) return;
if (scene && this->scene) throw std::runtime_error("Drawable has been associated with a scene already!");
this->scene = scene;
if(scene) scene->RegisterDrawable(this);
}
void Drawable::RemoveNode(Node* node)
{
Utils::Remove(nodes, node);
if (nodes.empty())
{
scene = nullptr;
scene->RemoveDrawable(this);
}
}
}
}