DDRAW: ComputeSphereVisibility: Am I in the good way?

paulo lesgaz jeremielapuree at yahoo.fr
Thu Nov 13 08:40:15 CST 2008


I would like to implement ComputeSphereVisibility. The sting game is completely black because of this stubbed function. Here is my idea to implement it. Am I in the good way, or it is completely a bad idea?

With GetViewport, I retrieve the viewport matrix V, and with  GetTransform, I retrieve projection P and world W matrices ofn the device.

I multiply the three matrices in a matrice M: M=VPW

If M is singular, function returns with a failing message
Otherwise, with the matrix M I retrieve the  planes of the frustum view (that's a little bit of math, but quite easy)

Then for each sphere,

  Let Visibility=0
    for each plane of the frustum view
   Let I be the intersection of the orthogonal projection of the center sphere on the plane. 
   If I is in the frustum view,
 then I have the visibility.So 
    Visibility=Visibility|(flag for the visibility of the chosen plane)

Once I did it for the 6 plane, I have the visibility of the sphere.

Is it a good point of start?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20081113/29041efc/attachment.htm 

More information about the wine-devel mailing list