矩阵处增加非常重要的注释

This commit is contained in:
hyzboy 2019-07-12 10:13:01 +08:00
parent fc67299042
commit 8dca542974
3 changed files with 6 additions and 2 deletions

View File

@ -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(); //更新矩阵计算
}

View File

@ -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);
}

View File

@ -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());
}