RecursiveLightPoint: add casts to double to force 64-bit precision, fixes zombie at the start of jam3_ericw.bsp from incorrectly being lit up in SSE builds.

See also: http://forums.inside3d.com/viewtopic.php?f=3&t=5620

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1155 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
ewasylishen 2015-01-26 06:46:53 +00:00
parent 62336450fe
commit 74f9ac215c
1 changed files with 7 additions and 2 deletions

View File

@ -267,6 +267,8 @@ mplane_t *lightplane;
vec3_t lightspot; vec3_t lightspot;
vec3_t lightcolor; //johnfitz -- lit support via lordhavoc vec3_t lightcolor; //johnfitz -- lit support via lordhavoc
#define DoublePrecisionDotProduct(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2])
/* /*
============= =============
RecursiveLightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc RecursiveLightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc
@ -323,8 +325,11 @@ loc0:
if (surf->flags & SURF_DRAWTILED) if (surf->flags & SURF_DRAWTILED)
continue; // no lightmaps continue; // no lightmaps
ds = (int) ((float) DotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]); // ericw -- added double casts to force 64-bit precision.
dt = (int) ((float) DotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]); // Without them the zombie at the start of jam3_ericw.bsp was
// incorrectly being lit up in SSE builds.
ds = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]);
dt = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]);
if (ds < surf->texturemins[0] || dt < surf->texturemins[1]) if (ds < surf->texturemins[0] || dt < surf->texturemins[1])
continue; continue;