mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Fix plane pixel center sampling bug
This commit is contained in:
parent
3ff021608d
commit
8311a18282
1 changed files with 13 additions and 5 deletions
|
@ -108,7 +108,7 @@ namespace swrenderer
|
|||
|
||||
planeang += M_PI / 2;
|
||||
double cosine = cos(planeang), sine = -sin(planeang);
|
||||
x = pl->right - viewport->CenterX - 0.5;
|
||||
x = pl->right - viewport->CenterX + 0.5;
|
||||
rightxfrac = _xscale * (cosine + x * xstep);
|
||||
rightyfrac = _yscale * (sine + x * ystep);
|
||||
x = pl->left - viewport->CenterX + 0.5;
|
||||
|
@ -117,8 +117,16 @@ namespace swrenderer
|
|||
|
||||
basexfrac = leftxfrac;
|
||||
baseyfrac = leftyfrac;
|
||||
xstepscale = (rightxfrac - leftxfrac) / (pl->right - pl->left + 1);
|
||||
ystepscale = (rightyfrac - leftyfrac) / (pl->right - pl->left + 1);
|
||||
if (pl->left != pl->right)
|
||||
{
|
||||
xstepscale = (rightxfrac - leftxfrac) / (pl->right - pl->left);
|
||||
ystepscale = (rightyfrac - leftyfrac) / (pl->right - pl->left);
|
||||
}
|
||||
else
|
||||
{
|
||||
xstepscale = 0;
|
||||
ystepscale = 0;
|
||||
}
|
||||
|
||||
minx = pl->left;
|
||||
|
||||
|
@ -166,8 +174,8 @@ namespace swrenderer
|
|||
|
||||
auto viewport = Thread->Viewport.get();
|
||||
|
||||
double curxfrac = basexfrac + xstepscale * (x1 + 0.5 - minx);
|
||||
double curyfrac = baseyfrac + ystepscale * (x1 + 0.5 - minx);
|
||||
double curxfrac = basexfrac + xstepscale * (x1 - minx);
|
||||
double curyfrac = baseyfrac + ystepscale * (x1 - minx);
|
||||
|
||||
double distance = viewport->PlaneDepth(y, planeheight);
|
||||
|
||||
|
|
Loading…
Reference in a new issue