本文整理汇总了C++中Quaternion::GenerateLocalRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Quaternion::GenerateLocalRotation方法的具体用法?C++ Quaternion::GenerateLocalRotation怎么用?C++ Quaternion::GenerateLocalRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion::GenerateLocalRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GLCreateModelViewMatrix
/* FUNCTION: GLCreateModelViewMatrix
ARGUMENTS: m destination matrix
x,y,z position
yaw compass direction, 0-north, 90-east, 180-south, 270-west
pitch azimuth, -90 down, 0 forwad, 90 up
roll rotation around forward axis
RETURN: n/a
DESCRIPTION: Position camera
*/
void GLCreateModelViewMatrix(float *m, float x, float y, float z, float yaw, float pitch, float roll)
{
// same as gluLookAt
Quaternion q, qDir, qAzim;
qAzim.GenerateLocalRotation(pitch + 90.0f, -1.0f, 0.0f, 0.0f);
qDir.GenerateLocalRotation(yaw, 0.0f, 0.0f, 1.0f);
q = qAzim * qDir;
if (roll != 0)
{
Quaternion qTilt;
qTilt.GenerateLocalRotation(roll, 0, 0, 1);
q = qTilt * q;
}
q.CreateRotatedQuaternion(m);
// move camera
float mov[16];
GLCreateIdentityMatrix(mov);
mov[12] = -x;
mov[13] = -y;
mov[14] = -z;
GLMatrixMultiply(m, m, mov);
}