Re: DDRAW: ComputeSphereVisibility: Am I in the good way?
I need to use some functions implemented in d3dx8 to do the job. Can I link this dll to ddraw (even if it is not logical in a Windows point of view) or I need to reimplement all the needed math functions in wined3d? David --- En date de : Jeu 13.11.08, Henri Verbeet <hverbeet(a)gmail.com> a écrit : De: Henri Verbeet <hverbeet(a)gmail.com> Objet: Re: DDRAW: ComputeSphereVisibility: Am I in the good way? À: jeremielapuree(a)yahoo.fr Cc: wine-devel(a)winehq.org Date: Jeudi 13 Novembre 2008, 16h13 2008/11/13 paulo lesgaz <jeremielapuree(a)yahoo.fr>:
Hello
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?
David
The basic idea sounds about right. I don't think you need to project the sphere onto the frustum planes, just using the plane normal to calculate the distance to the sphere center should do.
2008/11/13 paulo lesgaz <jeremielapuree(a)yahoo.fr>:
I need to use some functions implemented in d3dx8 to do the job.
Can I link this dll to ddraw (even if it is not logical in a Windows point of view) or I need to reimplement all the needed math functions in wined3d?
David No, you can't use d3dx from ddraw or wined3d, but I don't think you need that many of them anyway.
participants (2)
-
Henri Verbeet -
paulo lesgaz