Fix update of model matrix

This commit is contained in:
Harald Reingruber
2022-05-12 16:25:58 +02:00
parent c0ecf480f9
commit 13c446f255

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