71template<
typename T> T ALKeyFrame::linearInterpolate(T tm, T ta, T va, T tb, T vb)
81 aiQuaternion irotation;
83 initNode->mTransformation.Decompose(iscale, irotation, ipos);
89 for (
unsigned int i = 0; i < keyframes.size(); ++i)
97 else if (tkey.
getTime() > mTime)
103 for (
unsigned int i = (keyframes.size() - 1); i >= 0; --i)
111 else if (tkey.
getTime() <= mTime)
122 if (pfound && !nfound)
126 else if (pfound && nfound)
128 mPosition.mValue.x =
static_cast<float>(linearInterpolate<double>(mTime, prevKey.
getTime(), prevKey.
getPosition().mValue.x,
131 mPosition.mValue.y =
static_cast<float>(linearInterpolate<double>(mTime, prevKey.
getTime(), prevKey.
getPosition().mValue.y,
134 mPosition.mValue.z =
static_cast<float>(linearInterpolate<double>(mTime, prevKey.
getTime(), prevKey.
getPosition().mValue.z,
144 for (
unsigned int i = 0; i < keyframes.size(); ++i)
152 else if (tkey.
getTime() > mTime)
158 for (
unsigned int i = (keyframes.size() - 1); i >= 0; --i)
166 else if (tkey.
getTime() <= mTime)
172 prevKey.
setScale(aiVectorKey(0, iscale));
177 if (pfound && !nfound)
181 else if (pfound && nfound)
183 mScale.mValue.x =
static_cast<float>(linearInterpolate<double>(mTime, prevKey.
getTime(), prevKey.
getScale().mValue.x,
186 mScale.mValue.y =
static_cast<float>(linearInterpolate<double>(mTime, prevKey.
getTime(), prevKey.
getScale().mValue.y,
189 mScale.mValue.z =
static_cast<float>(linearInterpolate<double>(mTime, prevKey.
getTime(), prevKey.
getScale().mValue.z,
198 for (
unsigned int i = 0; i < keyframes.size(); ++i)
206 else if (tkey.
getTime() > mTime)
212 for (
unsigned int i = (keyframes.size() - 1); i >= 0; --i)
220 else if (tkey.
getTime() <= mTime)
231 if (pfound && !nfound)
235 else if (pfound && nfound)
237 mRotation.mValue.Interpolate(mRotation.mValue, prevKey.
getRotation().mValue, nextKey.
getRotation().mValue,
static_cast<float>(fabs((prevKey.
getTime() - nextKey.
getTime()) / mTime)));