本文整理汇总了C++中FQuat::mul方法的典型用法代码示例。如果您正苦于以下问题:C++ FQuat::mul方法的具体用法?C++ FQuat::mul怎么用?C++ FQuat::mul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FQuat
的用法示例。
在下文中一共展示了FQuat::mul方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zviewpointHandleMsgFly
void ZViewpoint::zviewpointHandleMsgFly( ZMsg *msg ) {
static float viewpointMouseLast[2];
static int dragging = 0;
float newzviewpointScale = 0.f;
int scaleChange = 0;
if( (zmsgIs(type,ZUIMouseClickOn) || zmsgIs(type,MouseClick)) && zmsgIs(dir,D) && (zmsgIs(which,R) || zmsgIs(which,M)) && zmsgI(shift) && zmsgI(ctrl) && zmsgI(alt) ) {
// RESET
memset( &zviewpointTrans, 0, sizeof(zviewpointTrans) );
zviewpointRotQuat.fromAxisAngle( FVec3::XAxis, 0.f );
zviewpointScale = 1.f;
}
char button = msg->getS( "which", "X" ) [0];
// if( (zmsgIs(type,ZUIMouseClickOn) || zmsgIs(type,MouseClick)) && zmsgIs(dir,D) && zmsgIs(which,M) ) {
if( (zmsgIs(type,ZUIMouseClickOn) || zmsgIs(type,MouseClick)) && zmsgIs(dir,D) && button==zviewpointRotateButton ) {
dragging = zMouseMsgRequestExclusiveDrag( "type=Viewpoint_MouseDrag" );
}
if( zmsgIs(type,Viewpoint_MouseDrag) ) {
if( zmsgI(releaseDrag) ) {
zMouseMsgCancelExclusiveDrag();
}
else {
int _deltaX = zMouseMsgX - zMouseMsgLastX;
int _deltaY = zMouseMsgY - zMouseMsgLastY;
FQuat deltaX( FVec3::XAxis, -0.01f * _deltaX );
FQuat deltaY( FVec3::YAxis, +0.01f * _deltaY );
FQuat deltaZ;
deltaX.mul( zviewpointRotQuat );
deltaY.mul( deltaX );
deltaZ.mul( deltaY );
zviewpointRotQuat = deltaZ;
}
}
}
示例2: 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;
}