Graphics/ModelInstance: Add UpdateWorldMatrix method

This commit is contained in:
Jérôme Leclercq
2021-06-05 19:05:06 +02:00
parent bd1f5214b8
commit 743f8eeb24
4 changed files with 57 additions and 25 deletions

View File

@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/ModelInstance.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
@@ -21,6 +22,22 @@ namespace Nz
{
return *m_shaderBinding;
}
inline void ModelInstance::UpdateWorldMatrix(const Matrix4f& worldMatrix)
{
m_worldMatrix = worldMatrix;
if (!m_worldMatrix.GetInverseAffine(&m_invWorldMatrix))
NazaraError("failed to inverse world matrix");
m_dataInvalided = true;
}
inline void ModelInstance::UpdateWorldMatrix(const Matrix4f& worldMatrix, const Matrix4f& invWorldMatrix)
{
m_worldMatrix = worldMatrix;
m_invWorldMatrix = invWorldMatrix;
m_dataInvalided = true;
}
}
#include <Nazara/Graphics/DebugOff.hpp>