矩阵处增加非常重要的注释
This commit is contained in:
parent
fc67299042
commit
8dca542974
@ -277,8 +277,6 @@ public:
|
||||
camera.height=h;
|
||||
camera.center.Set(0,0,0,1);
|
||||
camera.eye.Set(100,100,0,1); //xyz三个值不要一样,以方便调试
|
||||
camera.znear=0.01f;
|
||||
camera.zfar=1024;
|
||||
|
||||
camera.Refresh(); //更新矩阵计算
|
||||
}
|
||||
|
@ -94,6 +94,10 @@ namespace hgl
|
||||
f / aspect_ratio, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, -f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, zfar / (znear - zfar), (znear * zfar) / (znear - zfar),
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// 某些引擎这两项会乘0.5,那是因为他们是 -1 to 1 的Z值设定,而我们是0 to 1,所以这里不用乘
|
||||
// 同理,camera的znear必须为无限接近0的正数,zfar为一个较大的正数,默认使用0.01/1024
|
||||
|
||||
0.0f, 0.0f, -1.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@ namespace hgl
|
||||
nup.x, nup.y, nup.z, 0.0f,
|
||||
-forward.x, -forward.y, -forward.z/2.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
// ^^^^^^
|
||||
// 某些引擎此项为0.5,这个会影响最终输出的z值,但我们这里必须为0
|
||||
|
||||
return result*translate(-eye.xyz());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user