XMMatrixPerspectiveFovLH

5.6.3.6 XMMatrixPerspectiveFovLH A perspective projection matrix can be built with the following XNA Math function: XMMATRIX XMMatrixPerspectiveFovLH( // returns projection matrix FLOAT FovAngleY, // vertical field of view angle in radians FLOAT AspectRatio, // aspect ratio = width / height FLOAT NearZ, // distance to near plane FLOAT FarZ); // distance to far plane The following code snippet illustrates how to use D3DXMatrixPerspectiveFovLH. Here, we specify a 45° vertical field of view, a near plane at z = 1, and a far plane at z = 1000 (these lengths are in view space). 

XMMATRIX P = XMMatrixPerspectiveFovLH(0.25f*MathX::Pi, AspectRatio(), 1.0f, 1000.0f); The aspect ratio is taken to match our window aspect ratio: float D3DApp::AspectRatio()const { return static_cast<float>(mClientWidth) / mClientHeight; }




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章