游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1674|回复: 3

D3D要如何算出最後看到的?D的尺寸

[复制链接]

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
发表于 2005-11-15 22:22:00 | 显示全部楼层 |阅读模式
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);

0

主题

237

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
发表于 2005-11-16 12:03:00 | 显示全部楼层

Re:D3D要如何算出最後看到的?D的尺寸

用 RHW 的 vertex吧.

如果已?用了, 那就是createwindow?r, 你是windowed mode, ?]有?算?p去window外框的大小, 因??indowed mode, 你的400x400是?window外框的.

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
 楼主| 发表于 2005-11-17 13:49:00 | 显示全部楼层

Re:D3D要如何算出最後看到的?D的尺寸

用 RHW 的 vertex,可以指定depth或z??

0

主题

237

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
发表于 2005-11-18 13:31:00 | 显示全部楼层

Re:D3D要如何算出最後看到的?D的尺寸

可以的, 但因??lpha blend/colorkey的??S, 有depth也是要自己做z-sorting的.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-22 16:39

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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