mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-11 12:51:27 +00:00
Fix wrapping and scaling issue for the U texture coordinate for sprites
This commit is contained in:
parent
b420347bab
commit
5814270980
1 changed files with 3 additions and 4 deletions
|
@ -954,15 +954,14 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += tex->GetWidth() * thingxscalemul;
|
tx += tex->GetWidth() * thingxscalemul;
|
||||||
double dtx2 = tx * xscale;
|
x2 = centerx + xs_RoundToInt(tx * xscale);
|
||||||
x2 = centerx + xs_RoundToInt(dtx2);
|
|
||||||
|
|
||||||
// off the left side or too small?
|
// off the left side or too small?
|
||||||
if ((x2 < WindowLeft || x2 <= x1))
|
if ((x2 < WindowLeft || x2 <= x1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xscale = spriteScale.X * xscale / tex->Scale.X;
|
xscale = spriteScale.X * xscale / tex->Scale.X;
|
||||||
iscale = (fixed_t)(tex->GetWidth() / (dtx2 - dtx1) * FRACUNIT);
|
iscale = (fixed_t)(FRACUNIT / xscale); // Round towards zero to avoid wrapping in edge cases
|
||||||
|
|
||||||
double yscale = spriteScale.Y / tex->Scale.Y;
|
double yscale = spriteScale.Y / tex->Scale.Y;
|
||||||
|
|
||||||
|
@ -990,7 +989,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
vis->xiscale = iscale;
|
vis->xiscale = iscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
vis->startfrac += (fixed_t)(vis->xiscale * (vis->x1 - centerx - dtx1 + 0.5 * thingxscalemul));
|
vis->startfrac += (fixed_t)(vis->xiscale * (vis->x1 - centerx + 0.5 - dtx1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue