Re: [D3D] Fixed XYZRHW vertex handling
--- dlls/ddraw/d3ddevice/mesa_old.c 2004-08-05 15:11:43.000000000 +0100 +++ dlls/ddraw/d3ddevice/mesa.c 2004-08-05 12:50:45.000000000 +0100 @@ -1172,7 +1172,7 @@ glVertex3fv(coords); } inline static void handle_xyzrhw(D3DVALUE *coords) { - if (coords[3] < 1e-8) + if ((coords[3] < 1e-8) && (coords[3] > -1e-8)) glVertex3fv(coords); else { GLfloat w = 1.0 / coords[3]; This could be a job for fabsf of fabs (might be more portable): + if (fabsf(coords[3]) < 1e-8) -- Francois Gouget fgouget(a)free.fr http://fgouget.free.fr/ Any sufficiently advanced bug is indistinguishable from a feature. -- from some indian guy
Francois Gouget wrote:
--- dlls/ddraw/d3ddevice/mesa_old.c 2004-08-05 15:11:43.000000000 +0100 +++ dlls/ddraw/d3ddevice/mesa.c 2004-08-05 12:50:45.000000000 +0100 @@ -1172,7 +1172,7 @@ glVertex3fv(coords); } inline static void handle_xyzrhw(D3DVALUE *coords) { - if (coords[3] < 1e-8) + if ((coords[3] < 1e-8) && (coords[3] > -1e-8)) glVertex3fv(coords); else { GLfloat w = 1.0 / coords[3];
This could be a job for fabsf of fabs (might be more portable):
+ if (fabsf(coords[3]) < 1e-8)
This is cleaner but it adds an extra call. Since handle_xyzrhw is "call" for each vertex, I would leave it as is. :-) Bye, Christian
participants (2)
-
Christian Costa -
Francois Gouget