本文整理汇总了C++中FQuat::identity方法的典型用法代码示例。如果您正苦于以下问题:C++ FQuat::identity方法的具体用法?C++ FQuat::identity怎么用?C++ FQuat::identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FQuat
的用法示例。
在下文中一共展示了FQuat::identity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zviewpointRotateTrackball
void ZViewpoint::zviewpointRotateTrackball( float dx, float dy, float side ) {
// ROTATE: this was originally in the message handler for trackball mode
// reponse to mouse drag. I factored out to here so that I can call this
// code in response to arrow keys to step-rotate the object about a given
// axis. (tfb)
// COMPUTE the world axises about which we are spinning (i.e. the screen axis)
FMat4 ref( zviewpointReferenceModel.m );
FMat4 rot = zviewpointRotQuat.mat();
rot.transpose();
ref.cat( rot );
ref.setTrans( FVec3::Origin );
ref.orthoNormalize();
ref.inverse();
// ref is now the transform that will take a point in eye-coordinates and
// transform it to its original pre-viewing-transform world coordinates. tfb
FVec3 xEye = ref.mul( FVec3::XAxis );
FVec3 yEye = ref.mul( FVec3::YAxis );
FVec3 zEye = ref.mul( FVec3::ZAxis );
FQuat deltaX( xEye, dy );
if( !zviewpointPermitRotX ) deltaX.identity();
FQuat deltaY( yEye, dx );
if( !zviewpointPermitRotY ) deltaY.identity();
FQuat deltaZ;
if( side != 0 ) {
deltaX.identity();
deltaY.identity();
deltaZ.fromAxisAngle( zEye, side * -dy );
}
if( !zviewpointPermitRotZ ) deltaZ.identity();
// QUATERNION multiply the delta by the origial to get the new
deltaX.mul( zviewpointRotQuat );
deltaY.mul( deltaX );
deltaZ.mul( deltaY );
zviewpointRotQuat = deltaZ;
}