本文整理汇总了C++中KeyFrame::interpolateValueFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyFrame::interpolateValueFrom方法的具体用法?C++ KeyFrame::interpolateValueFrom怎么用?C++ KeyFrame::interpolateValueFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyFrame
的用法示例。
在下文中一共展示了KeyFrame::interpolateValueFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFrame
bool AnimationTrack::getFrame(f32 timeMs, KeyFrame& frame) const
{
array_t<KeyFrame*>::const_iterator iterKeyframeBefore;
array_t<KeyFrame*>::const_iterator iterKeyframeAfter;
// get the key frame after the requested time
iterKeyframeAfter = getUpperBound(timeMs);
// check if the time is after the last key frame
if(iterKeyframeAfter == m_keyFrames.end())
{
// return the last key frame
--iterKeyframeAfter;
frame = *(*iterKeyframeAfter);
return true;
}
// check if the time is before the first key frame
if(iterKeyframeAfter == m_keyFrames.begin())
{
// return the first key frame
frame = *(*iterKeyframeAfter);
return true;
}
// get the key frame before the requested one
iterKeyframeBefore = iterKeyframeAfter;
--iterKeyframeBefore;
// get the two key frame
KeyFrame& keyframeBefore = *(*iterKeyframeBefore);
KeyFrame& keyframeAfter = *(*iterKeyframeAfter);
// blend between the two key frames
//Note: use interp type of compute time blend pct, and use linear for value interp, and should take care of rotation
frame.interpolateValueFrom(keyframeBefore, keyframeAfter);
return true;
}