Merge pull request #300 from haraldreingruber-dedalus/fix_update_model_matrix

[scenegraph] Fix update of model matrix
This commit is contained in:
Joey de Vries
2023-01-19 11:14:17 +01:00
committed by GitHub

View File

@@ -38,11 +38,13 @@ public:
void computeModelMatrix()
{
m_modelMatrix = getLocalModelMatrix();
m_isDirty = false;
}
void computeModelMatrix(const glm::mat4& parentGlobalModelMatrix)
{
m_modelMatrix = parentGlobalModelMatrix * getLocalModelMatrix();
m_isDirty = false;
}
void setLocalPosition(const glm::vec3& newPosition)
@@ -439,10 +441,15 @@ public:
//Update transform if it was changed
void updateSelfAndChild()
{
if (!transform.isDirty())
if (transform.isDirty()) {
forceUpdateSelfAndChild();
return;
forceUpdateSelfAndChild();
}
for (auto&& child : children)
{
child->updateSelfAndChild();
}
}
//Force update of transform even if local space don't change