游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2432|回复: 5

projection Matrix in D3D

[复制链接]

50

主题

992

帖子

1012

积分

金牌会员

Rank: 6Rank: 6

积分
1012
发表于 2004-6-8 14:53:00 | 显示全部楼层 |阅读模式
?DX9SDK???projection Matrix??      w  0   0     0
                                                           0  h   0     0
                                                           0  0   Q     1
                                                           0  0 -Qzn  0
w=ctg(fovw/2)
h= cth(fovh/2)
Q=zf/(zf-zn)

??????????????????projection Matrix???
                                                          w  0   0     0
                                                           0  h   0     0
                                                           0  0   Q     -Qzn
                                                           0  0   1     0
???.....

50

主题

992

帖子

1012

积分

金牌会员

Rank: 6Rank: 6

积分
1012
 楼主| 发表于 2004-6-10 14:15:00 | 显示全部楼层

Re:projection Matrix in D3D

????????????????????????????

6

主题

444

帖子

457

积分

中级会员

Rank: 3Rank: 3

积分
457
发表于 2004-6-10 14:22:00 | 显示全部楼层

Re:projection Matrix in D3D

????

50

主题

992

帖子

1012

积分

金牌会员

Rank: 6Rank: 6

积分
1012
 楼主| 发表于 2004-6-10 17:36:00 | 显示全部楼层

Re:projection Matrix in D3D

?????????????????????

50

主题

992

帖子

1012

积分

金牌会员

Rank: 6Rank: 6

积分
1012
 楼主| 发表于 2004-6-16 23:03:00 | 显示全部楼层

Re:projection Matrix in D3D

???

9

主题

198

帖子

198

积分

注册会员

Rank: 2

积分
198
发表于 2004-6-17 00:45:00 | 显示全部楼层

Re:projection Matrix in D3D

??????projection matrix, ??dx9??????????????
  
Microsoft DirectX 9.0 SDK Update (Summer 2003)
Setting Up a Projection Matrix

--------------------------------------------------------------------------------

The following ProjectionMatrix sample function sets the front and back clipping planes, as well as the horizontal and vertical field of view angles. This code parallels the approach discussed in the What Is the Projection Transformation? topic. The fields of view should be less than pi radians.

D3DXMATRIX
ProjectionMatrix(const float near_plane, // Distance to near clipping
                                         // plane
                 const float far_plane,  // Distance to far clipping
                                         // plane
                 const float fov_horiz,  // Horizontal field of view
                                         // angle, in radians
                 const float fov_vert)   // Vertical field of view
                                         // angle, in radians
{
    float    h, w, Q;

    w = (float)1/tan(fov_horiz*0.5);  // 1/tan(x) == cot(x)
    h = (float)1/tan(fov_vert*0.5);   // 1/tan(x) == cot(x)
    Q = far_plane/(far_plane - near_plane);

    D3DXMATRIX ret;
    ZeroMemory(&ret, sizeof(ret));

    ret(0, 0) = w;
    ret(1, 1) = h;
    ret(2, 2) = Q;
    ret(3, 2) = -Q*near_plane;
    ret(2, 3) = 1;
    return ret;
}   // End of ProjectionMatrix

After creating the matrix, set it with IDirect3DDevice9::SetTransform specifying D3DTS_PROJECTION.

The D3DX utility library provides the following functions to help you set up your projections matrix.

D3DXMatrixPerspectiveLH
D3DXMatrixPerspectiveRH
D3DXMatrixPerspectiveFovLH
D3DXMatrixPerspectiveFovRH
D3DXMatrixPerspectiveOffCenterLH
D3DXMatrixPerspectiveOffCenterRH

--------------------------------------------------------------------------------

© 2003 Microsoft Corporation. All rights reserved.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-11-7 11:52

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表