两个关于投影的问题

rookie_ 2006-02-20 08:56:46
1.It is important to know that we define the projection window with the dimensions min = (–1, –1) and max = (1, 1).
//上面的意思是不是说,我们通常把投影窗口设置为Z=1上最小点为(–1, –1) 和最大点为(1, 1)的一个矩形?

2.CalcPickingRay(int x, int y)
{
float px = 0.0f;
float py = 0.0f;

D3DVIEWPORT9 vp;
//Retrieves the viewport parameters currently set for the device
Device->GetViewport(&vp);

D3DXMATRIX proj;
Device->GetTransform(D3DTS_PROJECTION, &proj);

// 将屏幕点击坐标转化成投影平面坐标
px = ((( 2.0f*x) / vp.Width) - 1.0f) / proj(0, 0);
py = (((-2.0f*y) / vp.Height) + 1.0f) / proj(1, 1);
……………………

//这个是pick中的代码

我不明白的是

px = ((( 2.0f*x) / vp.Width) - 1.0f) / proj(0, 0);//这后面的除以proj(0, 0)是什么意思
py = (((-2.0f*y) / vp.Height) + 1.0f) / proj(1, 1); //问题同上

thanks!
...全文
74 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

8,305

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧