Add AddDrawableIfParentless function

This commit is contained in:
Georg Hagen
2024-06-23 10:53:05 +02:00
parent 9692ecf89d
commit ef666fae8f
2 changed files with 8 additions and 0 deletions

View File

@@ -74,6 +74,12 @@ namespace OpenVulkano::Scene
drawables.push_back(drawable);
}
void Node::AddDrawableIfParentless(Drawable* drawable)
{
if (drawable->GetNodes().empty())
AddDrawable(drawable);
}
void Node::RemoveDrawable(Drawable* drawable)
{
drawable->RemoveNode(this);

View File

@@ -57,6 +57,8 @@ namespace OpenVulkano::Scene
void RemoveDrawable(Drawable* drawable);
void AddDrawableIfParentless(Drawable* drawable);
void SetMatrix(const Math::Matrix4f& mat);
[[nodiscard]] Math::Matrix3f GetRotationMatrix() const { return static_cast<const Math::Matrix3f>(localMat); }