Model ​

translate rotation scale

View Matrix ​

lookat Matrix

lookAt(eye, target, up) 构造的是 view 矩阵,它把世界空间变换到相机空间:

pcam=V⋅pworld

它的构造步骤:

cpp
Vector3f f = normalize(target - eye);   // 前
Vector3f s = normalize(cross(f, up));   // 右
Vector3f u = cross(s, f);               // 上

然后矩阵是:

V=[sxsysz−s⋅eyeuxuyuz−u⋅eye−fx−fy−fzf⋅eye0001]

注意:

  • 符号

Projection Matrix ​

orthogonal Matrix ​

Perspective Matrix ​