|
|
D3D要如何算出最後看到的?D的尺寸
?窗大小??00x400
?一???D(???三角形?成的正方形)200x200放到z=0
eye point=(0.0f, 0.0f, -500.0f)
look-at target point=(0.0f, 0.0f, 0.0f)
最後看到的?D是191x177,不是200x200
明?的?淇s小了,???一下D3D要如何算出最後看到的?D的尺寸?
PS:?例?碓?2D 3D RPG角色扮演?? 程式??-使用DirectX的chapter06的Draw3D改??(??D停下??
PS:Source Code:http://www.vchelp.net/cndevforum/subject_view.asp?subject_id=161438&forum_id=28
sVertex Verts[4] = {
{ -100.0f, 100.0f, 0.0f, 0.0f, 0.0f },
{ 100.0f, 100.0f, 0.0f, 1.0f, 0.0f },
{ -100.0f, -100.0f, 0.0f, 0.0f, 1.0f },
{ 100.0f, -100.0f, 0.0f, 1.0f, 1.0f }
};
g_hWnd = CreateWindow(g_szClass, g_szCaption,
WS_CAPTION | WS_SYSMENU,
0, 0, 400, 400,
NULL, NULL,
hInst, NULL );
// Create and set the projection matrix
//D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4.0f, 1.33333f, 1.0f, 1000.0f);
D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4.0f, 1.0f, 1.0f, 1000.0f);
g_pD3DDevice->SetTransform(D3DTS_PROJECTION, &matProj);
// Create and set the view matrix
D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0.0f, 0.0f, -500.0f), &D3DXVECTOR3(0.0f, 0.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
g_pD3DDevice->SetTransform(D3DTS_VIEW, &matView); |
|