deleted codes of lookat

This commit is contained in:
2022-03-09 18:39:39 +08:00
parent 090fab9c0e
commit d1f7b588a3
2 changed files with 0 additions and 37 deletions

View File

@@ -68,14 +68,6 @@ namespace hgl
float znear,
float zfar);
/**
* 产生一个lookat变换矩阵
* @param eye 眼睛位置
* @param target 目标位置
* @param up 向上向量
*/
Matrix4f lookat(const Vector3f &eye,const Vector3f &target,const Vector3f &up);
inline Matrix4f translate(const Vector3f &v)
{
return glm::translate(Matrix4f(1.0f),v);

View File

@@ -102,33 +102,4 @@ namespace hgl
0.0f
);
}
Matrix4f lookat(const Vector3f &eye,const Vector3f &target,const Vector3f &up)
{
Vector3f forward=normalize(target-eye);
Vector3f right=normalize(cross(forward,up));
Vector3f nup=cross(right,forward);
return Matrix4f( right.x,
nup.x,
-forward.x,
0.0f,
right.y,
nup.y,
-forward.y,
0.0f,
right.z,
nup.z,
-forward.z/2.0f,
0.0f,
dot(eye,right ),
dot(eye,nup ),
dot(eye,forward),
1.0f
);
}
}//namespace hgl