DirectX9 投影

来源:互联网 发布:java代码漏洞扫描工具 编辑:程序博客网 时间:2024/05/09 18:12

投影

D3DXMATRIX *D3DXMatrixPerspectiveFovLH(

D3DXMATRIX* pOut, // returns projection matrix
FLOAT fovY, // vertical field of view angle in radians
FLOAT Aspect, // aspect ratio = width / height
FLOAT zn, // distance to near plane
FLOAT zf // distance to far plane

);


The projection matrix is set with theIDirect3DDevice9::SetTransformmethod, passingD3DTS_PROJECTIONas the transform type. The following example creates a projection matrix based on a frustum with a 90-degree field of view, a near plane with a distance of 1, and a far plane with a distance of 1000.

D3DXMATRIX proj;
D3DXMatrixPerspectiveFovLH(&proj, PI * 0.5f, (float)width / (float)height, 1.0, 1000.0f);
Device->SetTransform(D3DTS_PROJECTION, &proj);

0 0