message: Code cleanup and simplification
diff: @@ -534,27 +534,24 @@ void VulkanglTFModel::updateAnimation(float deltaTime)
  animation.currentTime -= animation.end;
  }
  - bool updated = false;
  for (auto &channel : animation.channels)
  {
  AnimationSampler &sampler = animation.samplers[channel.samplerIndex];
  - if (sampler.inputs.size() > sampler.outputsVec4.size())
  + for (size_t i = 0; i < sampler.inputs.size() - 1; i++)
  + {
  + if (sampler.interpolation != "LINEAR")
  {
  + std::cout << "This sample only supports linear interpolations\n";
  continue;
  }
  - for (size_t i = 0; i < sampler.inputs.size() - 1; i++)
  - {
  + // Get the input keyframe values for the current time stamp
  if ((animation.currentTime >= sampler.inputs[i]) && (animation.currentTime <= sampler.inputs[i + 1]))
  {
  - float u = std::max(0.0f, animation.currentTime - sampler.inputs[i]) / (sampler.inputs[i + 1] - sampler.inputs[i]);
  - if (u <= 1.0f)
  - {
  + float a = (animation.currentTime - sampler.inputs[i]) / (sampler.inputs[i + 1] - sampler.inputs[i]);
  if (channel.path == "translation")
  {
  - glm::vec4 trans = glm::mix(sampler.outputsVec4[i], sampler.outputsVec4[i + 1], u);
  - channel.node->translation = glm::vec3(trans);
  - updated = true;
  + channel.node->translation = glm::mix(sampler.outputsVec4[i], sampler.outputsVec4[i + 1], a);
  }
  if (channel.path == "rotation")
  {
  @@ -563,32 +560,27 @@ void VulkanglTFModel::updateAnimation(float deltaTime)
  q1.y = sampler.outputsVec4[i].y;
  q1.z = sampler.outputsVec4[i].z;
  q1.w = sampler.outputsVec4[i].w;
  +
  glm::quat q2;
  q2.x = sampler.outputsVec4[i + 1].x;
  q2.y = sampler.outputsVec4[i + 1].y;
  q2.z = sampler.outputsVec4[i + 1].z;
  q2.w = sampler.outputsVec4[i + 1].w;
  - channel.node->rotation = glm::normalize(glm::slerp(q1, q2, u));
  - updated = true;
  +
  + channel.node->rotation = glm::normalize(glm::slerp(q1, q2, a));
  }
  if (channel.path == "scale")
  {
  - glm::vec4 trans = glm::mix(sampler.outputsVec4[i], sampler.outputsVec4[i + 1], u);
  - channel.node->scale = glm::vec3(trans);
  - updated = true;
  - }
  + channel.node->scale = glm::mix(sampler.outputsVec4[i], sampler.outputsVec4[i + 1], a);
  }
  }
  }
  }
  - if (updated)
  - {
  for (auto &node : nodes)
  {
  updateJoints(node);
  }
  }
  -}
  /*
  glTF rendering functions
  