|
|
在场景中,由于存在空间概念,所以不能光用z值来判断。
在opengl中
// this asks OGL to guess the 2d position of a 3d point inside the viewport
gluProject(p.x, p.y, p.z, mvmatrix, projmatrix, viewport, &winx, &winy, &winz);
flareZ = winz;
// we read back one pixel from th depth buffer (exactly where our flare should be drawn)
glReadPixels(winx, winy,1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &bufferZ);
比较flareZ 和 bufferZ来判断是否被遮挡。
在 dx 中,是否有类似的函数?
还有再问一下 pos*WorldMatrix * ViewMatrix * projectMatrix 得到的是不是就是屏幕坐标了,比如800*600屏幕中的 s_x = 200,s_y =300;之类的? |
|