两个关于投影的问题
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!