summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFLoader.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-03 01:53:34 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-03 01:53:34 +0000
commit20b0c1a588371cfaa1ae7aedb670b4e0101c9e3d (patch)
tree0e4303a6998c16442bfb6434a277159699df22af /AssetLoader/src/GLTFLoader.cpp
parentGLTF Loader: switched to using texture arrays (diff)
downloadDiligentTools-20b0c1a588371cfaa1ae7aedb670b4e0101c9e3d.tar.gz
DiligentTools-20b0c1a588371cfaa1ae7aedb670b4e0101c9e3d.zip
GLTF Loader: using dynamic array of joint transform matrices instead of the fixed one
Diffstat (limited to 'AssetLoader/src/GLTFLoader.cpp')
-rw-r--r--AssetLoader/src/GLTFLoader.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/AssetLoader/src/GLTFLoader.cpp b/AssetLoader/src/GLTFLoader.cpp
index 6683066..6665b89 100644
--- a/AssetLoader/src/GLTFLoader.cpp
+++ b/AssetLoader/src/GLTFLoader.cpp
@@ -235,16 +235,15 @@ void Node::Update()
if (_Skin != nullptr)
{
// Update join matrices
- auto InverseTransform = _Mesh->Transforms.matrix.Inverse(); // TODO: do not use inverse tranform here
- size_t numJoints = std::min((uint32_t)_Skin->Joints.size(), Uint32{Mesh::TransformData::MaxNumJoints});
- for (size_t i = 0; i < numJoints; i++)
+ auto InverseTransform = _Mesh->Transforms.matrix.Inverse(); // TODO: do not use inverse tranform here
+ if (_Mesh->Transforms.jointMatrices.size() != _Skin->Joints.size())
+ _Mesh->Transforms.jointMatrices.resize(_Skin->Joints.size());
+ for (size_t i = 0; i < _Skin->Joints.size(); i++)
{
auto* JointNode = _Skin->Joints[i];
- auto JointMat = _Skin->InverseBindMatrices[i] * JointNode->GetMatrix() * InverseTransform;
-
- _Mesh->Transforms.jointMatrix[i] = JointMat;
+ _Mesh->Transforms.jointMatrices[i] =
+ _Skin->InverseBindMatrices[i] * JointNode->GetMatrix() * InverseTransform;
}
- _Mesh->Transforms.jointcount = static_cast<int>(numJoints);
}
}