code refactoring

This commit is contained in:
ohyzha
2024-11-04 22:48:35 +02:00
parent 3d96889778
commit e2df88ca22
7 changed files with 71 additions and 45 deletions

View File

@@ -110,6 +110,15 @@ namespace OpenVulkano::Scene
UpdateWorldMatrix(parent ? parent->GetWorldMatrix() : Math::Matrix4f(1));
}
Node* Node::GetRoot()
{
if (IsRoot() || !parent)
{
return this;
}
return parent->GetRoot();
}
void Node::UpdateWorldMatrix(const Math::Matrix4f& parentWorldMat)
{
worldMat = parentWorldMat * localMat;