mirror of
https://github.com/w23/xash3d-fwgs
synced 2025-01-18 23:00:01 +01:00
engine: common: fixed lightmap shifting caused by insufficent precision in Mod_CalcSurfaceExtents
This commit is contained in:
parent
e07417aead
commit
24ea8fba4b
@ -1020,8 +1020,8 @@ Fills in surf->texturemins[] and surf->extents[]
|
||||
*/
|
||||
static void Mod_CalcSurfaceExtents( msurface_t *surf )
|
||||
{
|
||||
float mins[2], maxs[2], val;
|
||||
float lmmins[2], lmmaxs[2];
|
||||
double mins[2], maxs[2], val;
|
||||
double lmmins[2], lmmaxs[2];
|
||||
int bmins[2], bmaxs[2];
|
||||
int i, j, e, sample_size;
|
||||
mextrasurf_t *info = surf->info;
|
||||
@ -1049,14 +1049,14 @@ static void Mod_CalcSurfaceExtents( msurface_t *surf )
|
||||
|
||||
for( j = 0; j < 2; j++ )
|
||||
{
|
||||
val = DotProduct( v->position, surf->texinfo->vecs[j] ) + surf->texinfo->vecs[j][3];
|
||||
val = DotProductPrecise( v->position, surf->texinfo->vecs[j] ) + surf->texinfo->vecs[j][3];
|
||||
mins[j] = Q_min( val, mins[j] );
|
||||
maxs[j] = Q_max( val, maxs[j] );
|
||||
}
|
||||
|
||||
for( j = 0; j < 2; j++ )
|
||||
{
|
||||
val = DotProduct( v->position, info->lmvecs[j] ) + info->lmvecs[j][3];
|
||||
val = DotProductPrecise( v->position, info->lmvecs[j] ) + info->lmvecs[j][3];
|
||||
lmmins[j] = Q_min( val, lmmins[j] );
|
||||
lmmaxs[j] = Q_max( val, lmmaxs[j] );
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ GNU General Public License for more details.
|
||||
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
|
||||
#define DotProductAbs(x,y) (abs((x)[0]*(y)[0])+abs((x)[1]*(y)[1])+abs((x)[2]*(y)[2]))
|
||||
#define DotProductFabs(x,y) (fabs((x)[0]*(y)[0])+fabs((x)[1]*(y)[1])+fabs((x)[2]*(y)[2]))
|
||||
#define DotProductPrecise(x,y) ((double)(x)[0]*(double)(y)[0]+(double)(x)[1]*(double)(y)[1]+(double)(x)[2]*(double)(y)[2])
|
||||
#define CrossProduct(a,b,c) ((c)[0]=(a)[1]*(b)[2]-(a)[2]*(b)[1],(c)[1]=(a)[2]*(b)[0]-(a)[0]*(b)[2],(c)[2]=(a)[0]*(b)[1]-(a)[1]*(b)[0])
|
||||
#define Vector2Subtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1])
|
||||
#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
|
||||
|
Loading…
x
Reference in New Issue
Block a user