1
0
Fork 0
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:
fgenesis 2025-01-08 03:52:45 +01:00
parent 9e75e2093e
commit 2b2d4c712f

View file

@ -654,21 +654,14 @@ SkeletalKeyframe *Animation::getFirstKeyframe()
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++)
{
for (size_t j = 0; j < keyframes.size()-1; j++)
{
if (keyframes[j].t > keyframes[j+1].t)
{
SkeletalKeyframe temp = keyframes[j+1];
keyframes[j+1] = keyframes[j];
keyframes[j] = temp;
}
}
}
void Animation::reorderKeyframes()
{
std::sort(keyframes.begin(), keyframes.end(), keyframeCmp);
}
void Animation::cloneKey(size_t key, float toffset)