workaround for division by zero on fog calculation

This commit is contained in:
degasus 2013-02-07 02:21:30 +01:00
parent e7a8d3f854
commit dae1226e1b
1 changed files with 2 additions and 0 deletions

View File

@ -1322,6 +1322,8 @@ static void WriteFog(char *&p)
// perspective // perspective
// ze = A/(B - (Zs >> B_SHF) // ze = A/(B - (Zs >> B_SHF)
WRITE (p, "\tfloat ze = " I_FOG"[1].x / (" I_FOG"[1].y - (zCoord / " I_FOG"[1].w));\n"); WRITE (p, "\tfloat ze = " I_FOG"[1].x / (" I_FOG"[1].y - (zCoord / " I_FOG"[1].w));\n");
WRITE (p, "\tif(isnan(ze))\n"); // TODO: on intel/mesa, here will be a division by zero
WRITE (p, "\t\tze = 0.0f;\n");
} }
else else
{ {