mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-01-24 17:26:41 +00:00
exorcise another sneaky case of bubble sort
This commit is contained in:
parent
9e75e2093e
commit
2b2d4c712f
1 changed files with 6 additions and 13 deletions
|
@ -654,21 +654,14 @@ SkeletalKeyframe *Animation::getFirstKeyframe()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::reorderKeyframes()
|
inline static bool keyframeCmp(const SkeletalKeyframe& a, const SkeletalKeyframe& b)
|
||||||
{
|
{
|
||||||
|
return a.t < b.t;
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < keyframes.size(); i++)
|
void Animation::reorderKeyframes()
|
||||||
{
|
|
||||||
for (size_t j = 0; j < keyframes.size()-1; j++)
|
|
||||||
{
|
|
||||||
if (keyframes[j].t > keyframes[j+1].t)
|
|
||||||
{
|
{
|
||||||
SkeletalKeyframe temp = keyframes[j+1];
|
std::sort(keyframes.begin(), keyframes.end(), keyframeCmp);
|
||||||
keyframes[j+1] = keyframes[j];
|
|
||||||
keyframes[j] = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::cloneKey(size_t key, float toffset)
|
void Animation::cloneKey(size_t key, float toffset)
|
||||||
|
|
Loading…
Reference in a new issue