投影
D3DXMATRIX *D3DXMatrixPerspectiveFovLH(
D3DXMATRIX* pOut, // returns projection matrixFLOAT 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);