Fixed, Crash when trying to animate a model that doesn't contain animations
This commit is contained in:
@@ -15,6 +15,12 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
|
||||
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
|
||||
if(skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName"]);
|
||||
|
||||
if(animation != nullptr) {
|
||||
|
||||
@@ -156,7 +156,6 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
|
||||
@@ -89,11 +89,8 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
|
||||
Reference in New Issue
Block a user