- reverting pull request #2361 - apparently pull request #2364 changed some behaviour and these two do not play nice together. One or the other unfortunately has to be rolled back to allow GZDoom to build properly again.

Revert "Restored r_orthographic behavior."

This reverts commit 26908f5bc5.

Revert "Changed all of the isometric functionality to mapinfo and playerinfo variables. Retained function of most of the CVars."

This reverts commit dc897eacc0.

Revert "Adding isometric camera mode with orthographic projection to current state of master branch of GZDoom."

This reverts commit d2c2c93cf1.
This commit is contained in:
Rachael Alexanderson 2024-01-21 08:17:09 -05:00
commit af08413e10
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
17 changed files with 5 additions and 186 deletions

View file

@ -162,40 +162,8 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
di->Viewpoint.FieldOfView = DAngle::fromDeg(fov); // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint)
// Switch viewpoint for isometric camera
if((r_isocam || (camera->Level->flags3 & LEVEL3_ISOMETRICMODE)) && camera->player != NULL)
{
float camdist = camera->Level->iso_dist;
float isocam_pitch = camera->Level->isocam_pitch;
if (r_isoviewpoint > 0)
{
isocam_pitch = r_iso_pitch;
camdist = r_iso_dist;
camera->player->isoyaw = 45.0 * (r_isoviewpoint - 1); // The eight cardinal directions
}
float inv_iso_dist = 1.0f/camdist; // camdist can change in next line
bool iso_ortho = ((r_isoviewpoint > 0) && r_orthographic) || ((r_isoviewpoint == 0) && camera->Level->flags3 & LEVEL3_ORTHOGRAPHIC);
if (iso_ortho) camdist = r_iso_camdist;
vp.Pos.X -= camdist * DAngle::fromDeg(camera->player->isoyaw).Cos();
vp.Pos.Y -= camdist * DAngle::fromDeg(camera->player->isoyaw).Sin();
vp.Pos.Z += camdist * FAngle::fromDeg(isocam_pitch).Tan() - 0.5 * camera->player->viewheight;
vp.HWAngles.Pitch = FAngle::fromDeg(isocam_pitch);
vp.Angles.Pitch = DAngle::fromDeg(isocam_pitch);
vp.Angles.Yaw = DAngle::fromDeg(camera->player->isoyaw);
vp.Angles.Roll = DAngle::fromDeg(0);
vp.showviewer = true; // Draw player sprite
r_drawplayersprites = false; // Don't draw first-person hands/weapons
// Stereo mode specific perspective projection
if (!iso_ortho) inv_iso_dist = 1.0f;
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio * inv_iso_dist, iso_ortho);
}
else // Regular first-person viewpoint
{
vp.showviewer = false;
r_drawplayersprites = true; // Restore first-person hands/weapons
// Stereo mode specific perspective projection
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio, false);
}
// Stereo mode specific perspective projection
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio);
// Stereo mode specific viewpoint adjustment
vp.Pos += eye.GetViewShift(vp.HWAngles.Yaw.Degrees());
di->SetupView(RenderState, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);

View file

@ -477,9 +477,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
// Rotate the sprite about the vector starting at the center of the sprite
// triangle strip and with direction orthogonal to where the player is looking
// in the x/y plane.
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) mat.Translate(0.0, z2 - zcenter, 0.0);
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) mat.Translate(0.0, zcenter - z2, 0.0);
}
mat.Translate(-center.X, -center.Z, -center.Y); // retreat from sprite center
@ -902,7 +900,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
{
bool mirror = false;
DAngle ang = (thingpos - vp.Pos).Angle();
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) ang = vp.Angles.Yaw;
FTextureID patch;
// [ZZ] add direct picnum override
if (isPicnumOverride)
@ -1022,20 +1019,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
x2 = x - viewvecY*rightfac;
y1 = y + viewvecX*leftfac;
y2 = y + viewvecX*rightfac;
if(di->Level->flags3 & LEVEL3_ISOMETRICSPRITES && (r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE))) // If sprites are drawn from an isometric perspective
{
float signX = 1.0;
float signY = 1.0;
if(viewvecX < 0) signX = -1.0;
if(viewvecY < 0) signY = -1.0;
if(viewvecX == 0) signX = 0.0;
if(viewvecY == 0) signY = 0.0;
x1 -= signX * thing->radius;
x2 -= signX * thing->radius;
y1 -= signY * thing->radius;
y2 -= signY * thing->radius;
}
break;
}
case RF_FLATSPRITE:
@ -1076,7 +1059,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
}
depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin);
if(r_isocam || (di->Level->flags3 & LEVEL3_ISOMETRICMODE)) depth = depth * vp.PitchCos - vp.PitchSin * z2; // Helps with stacking actors with small xy offsets
if (isSpriteShadow) depth += 1.f/65536.f; // always sort shadows behind the sprite.
// light calculation

View file

@ -101,35 +101,6 @@ CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE)
CVAR (Int, r_clearbuffer, 0, 0)
CVAR (Bool, r_drawvoxels, true, 0)
CVAR (Bool, r_drawplayersprites, true, 0) // [RH] Draw player sprites?
CVARD (Bool, r_isocam, false, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_CHEAT, "render from isometric viewpoint.")
CVARD (Bool, r_orthographic, true, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_CHEAT, "render orthographic projection. Only used with r_isocam")
CUSTOM_CVARD(Float, r_iso_pitch, 30.0f, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_CHEAT, "pitch for isometric camera: 0 to 89 degrees. Used only if r_isoviewpoint > 0.")
{
if (self < 0.f)
self = 0.f;
else if (self > 89.f)
self = 89.f;
}
CUSTOM_CVAR(Float, r_iso_camdist, 1000.0f, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_CHEAT)
{
// Keep this large to avoid texture clipping, not used if r_orthographic is false
if (self < 1000.f)
self = 1000.f;
}
CUSTOM_CVARD(Int, r_isoviewpoint, 0, CVAR_ARCHIVE, "Isometric viewpoint angle. 1 to 8 for cardinal directions using r_iso_pitch and r_iso_dist. 0 for ignore and use player->isoyaw, level->isocam_pitch and level->iso_dist (from mapinfo).")
{
if (self < 0)
self = 0;
else if (self > 8)
self = 8;
}
CUSTOM_CVARD(Float, r_iso_dist, 300.0, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_CHEAT, "how far the isometric camera (r_isocam) is in the XY plane. Used only if r_isoviewpoint > 0.")
{
if (self < 0.f)
self = 0.f;
else if (self > 1000.f)
self = 1000.f;
}
CUSTOM_CVAR(Float, r_quakeintensity, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (self < 0.f) self = 0.f;
@ -182,8 +153,6 @@ FRenderViewpoint::FRenderViewpoint()
Sin = 0.0;
TanCos = 0.0;
TanSin = 0.0;
PitchCos = 0.0;
PitchSin = 0.0;
camera = nullptr;
sector = nullptr;
FieldOfView = DAngle::fromDeg(90.); // Angles in the SCREENWIDTH wide window
@ -661,9 +630,6 @@ void FRenderViewpoint::SetViewAngle (const FViewWindow &viewwindow)
TanSin = viewwindow.FocalTangent * Sin;
TanCos = viewwindow.FocalTangent * Cos;
PitchSin = Angles.Pitch.Sin();
PitchCos = Angles.Pitch.Cos();
DVector2 v = Angles.Yaw.ToVector();
ViewVector.X = v.X;
ViewVector.Y = v.Y;

View file

@ -33,8 +33,6 @@ struct FRenderViewpoint
double Sin; // sin(Angles.Yaw)
double TanCos; // FocalTangent * cos(Angles.Yaw)
double TanSin; // FocalTangent * sin(Angles.Yaw)
double PitchCos; // cos(Angles.Pitch)
double PitchSin; // sin(Angles.Pitch)
AActor *camera; // camera actor
sector_t *sector; // [RH] keep track of sector viewing from