DDRAW: ComputeSphereVisibility: Am I in the good way?

paulo lesgaz jeremielapuree at yahoo.fr
Thu Nov 13 12:42:16 CST 2008


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 at gmail.com> a écrit :
De: Henri Verbeet <hverbeet at gmail.com>
Objet: Re: DDRAW: ComputeSphereVisibility: Am I in the good way?
À: jeremielapuree at yahoo.fr
Cc: wine-devel at winehq.org
Date: Jeudi 13 Novembre 2008, 16h13

2008/11/13 paulo lesgaz <jeremielapuree at 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.





      


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


More information about the wine-devel mailing list