Merge pull request #275 from NonLinearGuy/master

Fixed errors in skeletal animation code
This commit is contained in:
Joey de Vries
2022-02-20 17:50:22 +01:00
committed by GitHub
6 changed files with 11 additions and 11 deletions

View File

@@ -171,7 +171,7 @@ set(7.in_practice
set(GUEST_ARTICLES
8.guest/2020/oit
#8.guest/2020/skeletal_animation
8.guest/2020/skeletal_animation
8.guest/2021/1.scene/1.scene_graph
8.guest/2021/1.scene/2.frustum_culling
8.guest/2021/2.csm

View File

@@ -22,7 +22,7 @@ public:
m_FinalBoneMatrices.push_back(glm::mat4(1.0f));
}
void Animator::UpdateAnimation(float dt)
void UpdateAnimation(float dt)
{
m_DeltaTime = dt;
if (m_CurrentAnimation)
@@ -33,13 +33,13 @@ public:
}
}
void Animator::PlayAnimation(Animation* pAnimation)
void PlayAnimation(Animation* pAnimation)
{
m_CurrentAnimation = pAnimation;
m_CurrentTime = 0.0f;
}
void Animator::CalculateBoneTransform(const AssimpNodeData* node, glm::mat4 parentTransform)
void CalculateBoneTransform(const AssimpNodeData* node, glm::mat4 parentTransform)
{
std::string nodeName = node->name;
glm::mat4 nodeTransform = node->transformation;

View File

@@ -160,7 +160,7 @@ private:
}
glm::mat4 Bone::InterpolateScaling(float animationTime)
glm::mat4 InterpolateScaling(float animationTime)
{
if (1 == m_NumScalings)
return glm::scale(glm::mat4(1.0f), m_Scales[0].scale);

View File

@@ -1,4 +1,4 @@
#version 430 core
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;

View File

@@ -1,4 +1,4 @@
#version 430 core
#version 330 core
layout(location = 0) in vec3 pos;
layout(location = 1) in vec3 norm;

View File

@@ -124,7 +124,7 @@ int main()
ourShader.setMat4("projection", projection);
ourShader.setMat4("view", view);
auto transforms = animator.GetPoseTransforms();
auto transforms = animator.GetFinalBoneMatrices();
for (int i = 0; i < transforms.size(); ++i)
ourShader.setMat4("finalBonesTransformations[" + std::to_string(i) + "]", transforms[i]);