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