- partially fixed y-panning and removed the aspect factor.

y-panning is still not correct for all cases but better than before. The aspect factor is not needed, it looks like an artifact of both the software renderer and Polymost.
We get the same dimensions with proper matrices by setting this to 1.
This commit is contained in:
Christoph Oelckers 2021-03-17 20:02:50 +01:00
parent 65097c4098
commit 47dce8de8c
2 changed files with 2 additions and 6 deletions

View file

@ -108,8 +108,6 @@ struct FBunch
angle_t endangle; angle_t endangle;
}; };
const float aspect_factor = (1.28f / 1.333333f); // this factor gets applied by the original code - must check if needed or just an artifact of the weird math.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Bunches are groups of continuous lines // Bunches are groups of continuous lines
@ -617,8 +615,6 @@ static void SetProjection(const FRotator& rotation, FAngle fov)
{ {
fovratio = ratio; fovratio = ratio;
} }
ratio *= aspect_factor; // this factor gets applied by the original code - must check if needed or just an artifact of the weird math.
fovratio *= aspect_factor;
auto rotmat = eye.GetProjection(fov.Degrees, ratio, fovratio); auto rotmat = eye.GetProjection(fov.Degrees, ratio, fovratio);
renderSetProjectionMatrix(rotmat.get()); renderSetProjectionMatrix(rotmat.get());
} }
@ -626,7 +622,7 @@ static void SetProjection(const FRotator& rotation, FAngle fov)
static void SetViewMatrix(const FRotator& angles, float vx, float vy, float vz, bool mirror, bool planemirror) static void SetViewMatrix(const FRotator& angles, float vx, float vy, float vz, bool mirror, bool planemirror)
{ {
float mult = mirror ? -1.f : 1.f; float mult = mirror ? -1.f : 1.f;
float planemult = planemirror ? -aspect_factor : aspect_factor;// Level->info->pixelstretch : Level->info->pixelstretch; float planemult = planemirror ? -1.f : 1.f;// Level->info->pixelstretch : Level->info->pixelstretch;
VSMatrix mViewMatrix; VSMatrix mViewMatrix;
mViewMatrix.loadIdentity(); mViewMatrix.loadIdentity();

View file

@ -784,7 +784,7 @@ void HWWall::DoTexture(HWDrawInfo* di, walltype* wal, walltype* refwall, float r
auto setv = [=](float hl, float hr, float frac) -> float auto setv = [=](float hl, float hr, float frac) -> float
{ {
float h = hl + (hr - hl) * frac; float h = hl + (hr - hl) * frac;
h = ((float)(refheight - (h * 256)) / ((th * 2048.0f) / (float)(wal->yrepeat))) + ypanning; h = (-(float)(refheight + (h * 256)) / ((th * 2048.0f) / (float)(wal->yrepeat))) + ypanning;
if (wal->cstat & CSTAT_WALL_YFLIP) h = 1.f - h; if (wal->cstat & CSTAT_WALL_YFLIP) h = 1.f - h;
return h; return h;
}; };