|
D3DXMATRIX *D3DXMatrixPerspectiveFovLH( D3DXMATRIX *pOut,
FLOAT fovY,
FLOAT Aspect,
FLOAT zn,
FLOAT zf
);
Aspect
[in] Aspect ratio, defined as view space height divided by width.
Remarks
The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixPerspectiveFovLH function can be used as a parameter for another function.
This function computes the returned matrix as shown.
w 0 0 0
0 h 0 0
0 0 zf/(zf-zn) 1
0 0 -zn*zf/(zf-zn) 0
where:
h is the view space height. It is calculated from
h = cot(fovY/2);
w is the view space width. It is calculated from
w = h / Aspect.
从上面可以很明显的看到,Aspect=h/w.
-----------------------------------------------------
但是,《DirectX 9.0 3D游戏开发编程基础》的p70中把aspect ratio解释为:
纵横比(aspect ratio)=屏幕宽度(screen width)/屏幕高度(screen height)
------------------------------------------------------
这两个是反着的,而且《Direct3D游戏编程入门教程》CHAPTER8\MULTITEXTURE中的代码中
(HRESULT CMyD3DApplication::RestoreDeviceObjects()函数里面):
FLOAT fAspect = m_d3dsdBackBuffer.Width / (FLOAT)m_d3dsdBackBuffer.Height;
只有这样,正方体模型显示在视口上时,是标准的正方体。
如果改成“高/宽”,正方体模型在视口上显示时,是“压扁了”的立方体。
------------------------------------------------------
是不是SDK文档错了?还是我理解错了?还是什么别的原因? |
|