HACK: For some reason Blender likes to create a first frame that doesn't start at time 0

This commit is contained in:
2015-10-21 15:37:49 +02:00
parent 2df78e011a
commit e7c1dc20ba
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -293,6 +293,10 @@ dd::RawModel::RawModel(std::string fileName)
Skeleton::Animation::Keyframe animationFrame;
animationFrame.Index = keyframe;
animationFrame.Time = frameTimes[keyframe] / animation->mTicksPerSecond;
// HACK: For some reason Blender likes to create a first frame that doesn't start at time 0
if (keyframe == 0) {
animationFrame.Time = 0;
}
for (auto &kv2 : kv.second) {
int boneID = kv2.first;
auto &property = kv2.second;
+1 -1
View File
@@ -154,7 +154,7 @@ int dd::Skeleton::GetKeyframe(const Animation& animation, double time)
for (int keyframe = 0; keyframe < animation.Keyframes.size(); ++keyframe) {
if (animation.Keyframes[keyframe].Time > time)
return glm::max(0, keyframe - 1); // HACK: If the time is less than the first keyframe, don
return (keyframe - 1) % animation.Keyframes.size();
}
return 0;