本文整理汇总了C++中Quaternion::ClearData方法的典型用法代码示例。如果您正苦于以下问题:C++ Quaternion::ClearData方法的具体用法?C++ Quaternion::ClearData怎么用?C++ Quaternion::ClearData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion::ClearData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFrameOverlay
void Animation::SetFrameOverlay( F32 frame, AnimKey &state, F32 controlFrame) const
{
controlFrame;
U32 i;
#if 0
Quaternion conq;
conq.ClearData();
for (i = 1; i < keys.count; i++)
{
AnimKey &lastKey = keys[i - 1];
AnimKey &thisKey = keys[i];
if (controlFrame <= thisKey.frame)
{
// determine the current fraction to this cycle
F32 dk = thisKey.frame - lastKey.frame;
ASSERT( dk > 0);
F32 dfdk = (controlFrame - lastKey.frame) / dk;
if (lastKey.type & animQUATERNION)
{
// do a parametric interpolation of the quaternion using dfdk
conq = (thisKey.quaternion - lastKey.quaternion) * dfdk + lastKey.quaternion;
}
break;
}
}
#endif
// 0; 4; 0.923880, 0.382683, 0.0, 0.0;;,
// 0; 4; 0.898028, 0.439939, 0.0, 0.0;;,
// 0; 4; 0.868631, 0.495459, 0.0, 0.0;;,
// 0; 4; 0.770513, 0.637424, 0.0, 0.0;;,
for (i = 1; i < keys.count; i++)
{
AnimKey &lastKey = keys[i - 1];
AnimKey &thisKey = keys[i];
if (frame <= thisKey.frame)
{
// LOG_DIAG( ("%f ; %f ; %f", lastKey.frame, frame, thisKey.frame) );
ASSERT( lastKey.frame < thisKey.frame);
// determine the current fraction to this cycle
F32 dk = thisKey.frame - lastKey.frame;
ASSERT( dk > 0);
F32 dfdk = (frame - lastKey.frame) / dk;
if (lastKey.type & animQUATERNION)
{
// do a parametric interpolation of the quaternion using dfdk
Quaternion q = (thisKey.quaternion - lastKey.quaternion) * dfdk + lastKey.quaternion;
#if 1
if (q.Dot( q) <= 0)
{
LOG_WARN( ("Quat::Set q.Dot(q) <= 0: %f %f %f %f", q.s, q.v.x, q.v.y, q.v.z) );
LOG_WARN( ("lastKey.quat: %f %f %f %f", lastKey.quaternion.s, lastKey.quaternion.v.x, lastKey.quaternion.v.y, lastKey.quaternion.v.z) );
LOG_WARN( ("thisKey.quat: %f %f %f %f", thisKey.quaternion.s, thisKey.quaternion.v.x, thisKey.quaternion.v.y, thisKey.quaternion.v.z) );
LOG_WARN( ("dfdk: %f; lastKey.frame %f; thisKey.frame; frame", dfdk, lastKey.frame, thisKey.frame, frame) );
statQuatError = TRUE;
}
#else
ASSERT( q.Dot( q) > 0);
#endif
// blend in the quat
//
// q -= conq;
// q = state.quaternion * q;
// q.Set( PI * 0.11f, Matrix::I.right);
// q = state.quaternion * q;
state.Set( q );
}
break;
}
}
}