mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
-let's better be cautious about precision and use the CRT sin and cos functions for rotated plane textures.
This commit is contained in:
parent
027b8d29b8
commit
9f0c5d5909
1 changed files with 13 additions and 11 deletions
|
@ -1500,7 +1500,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
yscale = xs_ToFixed(32 - ds_ybits, _yscale);
|
yscale = xs_ToFixed(32 - ds_ybits, _yscale);
|
||||||
if (planeang != 0)
|
if (planeang != 0)
|
||||||
{
|
{
|
||||||
double cosine = planeang.Cos(), sine = planeang.Sin();
|
double cosine = cos(planeang.Radians()), sine = sin(planeang.Radians());
|
||||||
pviewx = FLOAT2FIXED(pl->xform.xOffs + ViewPos.X * cosine - ViewPos.Y * sine);
|
pviewx = FLOAT2FIXED(pl->xform.xOffs + ViewPos.X * cosine - ViewPos.Y * sine);
|
||||||
pviewy = FLOAT2FIXED(pl->xform.yOffs - ViewPos.X * sine - ViewPos.Y * cosine);
|
pviewy = FLOAT2FIXED(pl->xform.yOffs - ViewPos.X * sine - ViewPos.Y * cosine);
|
||||||
}
|
}
|
||||||
|
@ -1515,9 +1515,10 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
|
|
||||||
// left to right mapping
|
// left to right mapping
|
||||||
planeang = ViewAngle - 90 + planeang;
|
planeang = ViewAngle - 90 + planeang;
|
||||||
|
|
||||||
// Scale will be unit scale at FocalLengthX (normally SCREENWIDTH/2) distance
|
// Scale will be unit scale at FocalLengthX (normally SCREENWIDTH/2) distance
|
||||||
xstepscale = xs_RoundToInt(xscale * planeang.Cos() / FocalLengthX);
|
xstepscale = xs_RoundToInt(xscale * cos(planeang.Radians()) / FocalLengthX);
|
||||||
ystepscale = xs_RoundToInt(yscale * -planeang.Sin() / FocalLengthX);
|
ystepscale = xs_RoundToInt(yscale * -sin(planeang.Radians()) / FocalLengthX);
|
||||||
|
|
||||||
// [RH] flip for mirrors
|
// [RH] flip for mirrors
|
||||||
if (MirrorFlags & RF_XFLIP)
|
if (MirrorFlags & RF_XFLIP)
|
||||||
|
@ -1528,8 +1529,8 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
|
|
||||||
int x = pl->right - centerx;
|
int x = pl->right - centerx;
|
||||||
planeang += 90;
|
planeang += 90;
|
||||||
basexfrac = xs_RoundToInt(xscale * planeang.Cos()) + x*xstepscale;
|
basexfrac = xs_RoundToInt(xscale * cos(planeang.Radians())) + x*xstepscale;
|
||||||
baseyfrac = xs_RoundToInt(yscale * -planeang.Sin()) + x*ystepscale;
|
baseyfrac = xs_RoundToInt(yscale * -sin(planeang.Radians())) + x*ystepscale;
|
||||||
|
|
||||||
planeheight = fabs(pl->height.Zat0() - ViewPos.Z);
|
planeheight = fabs(pl->height.Zat0() - ViewPos.Z);
|
||||||
|
|
||||||
|
@ -1638,15 +1639,15 @@ void R_DrawTiltedPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
|
|
||||||
// m is the v direction vector in view space
|
// m is the v direction vector in view space
|
||||||
ang = DAngle(180.) - ViewAngle;
|
ang = DAngle(180.) - ViewAngle;
|
||||||
m[0] = yscale * ang.Cos();
|
m[0] = yscale * cos(ang.Radians());
|
||||||
m[2] = yscale * ang.Sin();
|
m[2] = yscale * sin(ang.Radians());
|
||||||
// m[1] = pl->height.ZatPointF (0, iyscale) - pl->height.ZatPointF (0,0));
|
// m[1] = pl->height.ZatPointF (0, iyscale) - pl->height.ZatPointF (0,0));
|
||||||
// VectorScale2 (m, 64.f/VectorLength(m));
|
// VectorScale2 (m, 64.f/VectorLength(m));
|
||||||
|
|
||||||
// n is the u direction vector in view space
|
// n is the u direction vector in view space
|
||||||
ang += 90;
|
ang += 90;
|
||||||
n[0] = -xscale * ang.Cos();
|
n[0] = -xscale * cos(ang.Radians());
|
||||||
n[2] = -xscale * ang.Sin();
|
n[2] = -xscale * sin(ang.Radians());
|
||||||
// n[1] = pl->height.ZatPointF (ixscale, 0) - pl->height.ZatPointF (0,0));
|
// n[1] = pl->height.ZatPointF (ixscale, 0) - pl->height.ZatPointF (0,0));
|
||||||
// VectorScale2 (n, 64.f/VectorLength(n));
|
// VectorScale2 (n, 64.f/VectorLength(n));
|
||||||
|
|
||||||
|
@ -1654,9 +1655,10 @@ void R_DrawTiltedPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
// how much you slope the surface. Use the commented-out code above instead to keep
|
// how much you slope the surface. Use the commented-out code above instead to keep
|
||||||
// the textures a constant size across the surface's plane instead.
|
// the textures a constant size across the surface's plane instead.
|
||||||
ang = pl->xform.Angle + pl->xform.baseAngle;
|
ang = pl->xform.Angle + pl->xform.baseAngle;
|
||||||
m[1] = pl->height.ZatPoint(ViewPos.X + yscale * ang.Sin(), ViewPos.Y + yscale * ang.Cos()) - zeroheight;
|
double cosine = cos(ang.Radians()), sine = sin(ang.Radians());
|
||||||
|
m[1] = pl->height.ZatPoint(ViewPos.X + yscale * sine, ViewPos.Y + yscale * cosine) - zeroheight;
|
||||||
ang += 90;
|
ang += 90;
|
||||||
n[1] = pl->height.ZatPoint(ViewPos.X + xscale * ang.Sin(), ViewPos.Y + xscale * ang.Cos()) - zeroheight;
|
n[1] = pl->height.ZatPoint(ViewPos.X + xscale * sine, ViewPos.Y + xscale * cosine) - zeroheight;
|
||||||
|
|
||||||
plane_su = p ^ m;
|
plane_su = p ^ m;
|
||||||
plane_sv = p ^ n;
|
plane_sv = p ^ n;
|
||||||
|
|
Loading…
Reference in a new issue