当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix4d::TransposeRotation方法代码示例

本文整理汇总了C++中Matrix4d::TransposeRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4d::TransposeRotation方法的具体用法?C++ Matrix4d::TransposeRotation怎么用?C++ Matrix4d::TransposeRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix4d的用法示例。


在下文中一共展示了Matrix4d::TransposeRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCameraPosAndUp

/// This only needs to be done once for all the particles, because the view
/// matrix does not change any between them.  If you were to modify the view
/// matrix at all, you would need to recalculate the camera pos and up vector.
void BillboardMatrixBase::GetCameraPosAndUp(Vector3d& vCameraPos, Vector3d& vCameraUp)
{
   Matrix4d mView;
   glGetDoublev(GL_MODELVIEW_MATRIX, mView.Data());

   // The values in the view matrix for the camera are the negative values of
   // the camera. This is because of the way gluLookAt works; I'm don't fully
   // understand why gluLookAt does what it does, but I know doing this works:)
   // I know that gluLookAt creates a the look vector as (eye - center), the
   // resulting direction vector is a vector from center to eye (the oposite
   // of what are view direction really is).
   vCameraPos = -mView.Column(3);
   vCameraUp  = mView.Row(1);

   // zero the translation in the matrix, so we can use the matrix to transform
   // camera postion to world coordinates using the view matrix
   mView.Column(3, Vector3d());

   // the view matrix is how to get to the gluLookAt pos from what we gave as
   // input for the camera position, so to go the other way we need to reverse
   // the rotation.  Transposing the matrix will do this.
   mView.TransposeRotation();

   // get the correct position of the camera in world space
   vCameraPos = mView * vCameraPos;
}
开发者ID:vividos,项目名称:MultiplayerOnlineGame,代码行数:29,代码来源:BillboardMatrix.cpp


注:本文中的Matrix4d::TransposeRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。