Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit ad25b50089b6e01b8e4291e34cfe3a008af9128d
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:12:46 2024 -0500

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

    This reverts commit d2c2c93.

commit 8537f0d8db804f0076b90daa66b750e44dccf44c
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:12:41 2024 -0500

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

    This reverts commit dc897ea.

commit d45f6ebf11f31d246f2de4f3bbd11f7970783125
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:10:21 2024 -0500

    Revert "Restored r_orthographic behavior."

    This reverts commit 26908f5.

commit be0836feef9b95f12828eeed4319c726ef13780d
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:09:15 2024 -0500

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

    This reverts commit 08b03e6.

commit 688288a9199b912203022cb4db37503f6270e0c3
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:09:06 2024 -0500

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

    This reverts commit d340583.

commit 72b7df9fa1841d665c2846dd31a89c6f48123e55
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:08:59 2024 -0500

    Revert "Restored r_orthographic behavior."

    This reverts commit e171f4e.

commit aa954132bf29f2f8a51bf09dae127e5ffe2c5670
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:08:48 2024 -0500

    Revert "Merged with latest master and made small change (zcenter -> center.Z) to hw_sprites.cpp. Now compiles and works."

    This reverts commit c8a7507.

commit 3ce90e87a3a9956b615995b57b90619e89bbcff4
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 12:00:46 2024 -0500

    Revert "Cleaning up implementation of isometric camera with optional orthographic projection."

    This reverts commit 25f1407.

commit 3aafd363e40c8d1d2ebbe3c61aeb2b80a74e565a
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 11:59:25 2024 -0500

    Revert "Small change to SpectatorCamera actor."

    This reverts commit 2b555d7.

commit a41911f8907731c098de71ca3e14261ac432ec8c
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 11:59:16 2024 -0500

    Revert "SpectatorCamera can now follow the 'tracer' actor. Also added a 'lagdistance' property for lazy follow."

    This reverts commit 7fbb4cd.

commit 19398edd065b7b483b8c7be42cb16026695e241a
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Feb 9 11:59:05 2024 -0500

    Revert "Minor addition toe SpectatorCamera. Added three chase modes to lazy follow. 0: Catch up until tracer is centered again. 1: Same but don't move if tracer isn't moving (camera moving when character is not is jarring). 2: Stop chasing if tracer is closer than lagdistance. Game modes benefit from a 'center camera' button but that doesn't have to be hard-baked into the engine."

    This reverts commit c3ca564.
  • Loading branch information
madame-rachelle committed Feb 9, 2024
1 parent 07d6b14 commit d8ef27e
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 192 deletions.
1 change: 0 additions & 1 deletion src/common/filesystem/source/file_zip.cpp
Expand Up @@ -35,7 +35,6 @@

#include <time.h>
#include <stdexcept>
#include <cstdint>
#include "w_zip.h"
#include "ancientzip.h"
#include "resourcefile.h"
Expand Down
20 changes: 2 additions & 18 deletions src/common/rendering/hwrenderer/data/hw_vrmodes.cpp
Expand Up @@ -146,27 +146,11 @@ float VREyeInfo::getShift() const
return vr_swap_eyes ? -res : res;
}

VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio, bool iso_ortho) const
VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio) const
{
VSMatrix result;

if (iso_ortho) // Orthographic projection for isometric viewpoint
{
double zNear = -1.0; // screen->GetZNear();
double zFar = screen->GetZFar();

double fH = tan(DEG2RAD(fov) / 2) / fovRatio;
double fW = fH * aspectRatio * mScaleFactor;
double left = -fW;
double right = fW;
double bottom = -fH;
double top = fH;

VSMatrix fmat(1);
fmat.ortho((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
return fmat;
}
else if (mShiftFactor == 0)
if (mShiftFactor == 0)
{
float fovy = (float)(2 * RAD2DEG(atan(tan(DEG2RAD(fov) / 2) / fovRatio)));
result.perspective(fovy, aspectRatio, screen->GetZNear(), screen->GetZFar());
Expand Down
2 changes: 1 addition & 1 deletion src/common/rendering/hwrenderer/data/hw_vrmodes.h
Expand Up @@ -27,7 +27,7 @@ struct VREyeInfo
float mShiftFactor;
float mScaleFactor;

VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio, bool iso_ortho) const;
VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const;
DVector3 GetViewShift(float yaw) const;
private:
float getShift() const;
Expand Down
3 changes: 0 additions & 3 deletions src/playsim/actor.h
Expand Up @@ -692,9 +692,6 @@ enum EViewPosFlags // [MC] Flags for SetViewPos.
{
VPSF_ABSOLUTEOFFSET = 1 << 1, // Don't include angles.
VPSF_ABSOLUTEPOS = 1 << 2, // Use absolute position.
VPSF_ALLOWOUTOFBOUNDS = 1 << 3, // Allow viewpoint to go out of bounds (hardware renderer only).
VPSF_ORTHOGRAPHIC = 1 << 4, // Use orthographic projection.
VPSF_ISOMETRICSPRITES = 1 << 5, // Displace sprites towards camera and don't billboard (drawn from isometric perspective).
};

enum EAnimOverrideFlags
Expand Down
6 changes: 1 addition & 5 deletions src/rendering/hwrenderer/hw_entrypoint.cpp
Expand Up @@ -163,11 +163,7 @@ 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)

// Stereo mode specific perspective projection
float inv_iso_dist = 1.0f;
bool iso_ortho = (camera->ViewPos != NULL) && (camera->ViewPos->Flags & VPSF_ORTHOGRAPHIC);
if (iso_ortho && (camera->ViewPos->Offset.XY().Length() > 0)) inv_iso_dist = 3.0f/camera->ViewPos->Offset.XY().Length();
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio * inv_iso_dist, iso_ortho);

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);
Expand Down
80 changes: 27 additions & 53 deletions src/rendering/hwrenderer/scene/hw_sprites.cpp
@@ -1,4 +1,4 @@
//
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2002-2016 Christoph Oelckers
Expand Down Expand Up @@ -94,7 +94,7 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -103,7 +103,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
bool additivefog = false;
bool foglayer = false;
int rel = fullbright ? 0 : getExtraLight();
auto &vp = di->Viewpoint;
auto &vp = di->Viewpoint;

if (translucent)
{
Expand Down Expand Up @@ -336,7 +336,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -391,7 +391,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)

return true;
}

// [BB] Billboard stuff
const bool drawWithXYBillboard = ((particle && gl_billboard_particles && !(particle->flags & SPF_NO_XY_BILLBOARD)) || (!(actor && actor->renderflags & RF_FORCEYBILLBOARD)
//&& di->mViewActor != nullptr
Expand Down Expand Up @@ -453,7 +453,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
float rollDegrees = doRoll ? Angles.Roll.Degrees() : 0;
float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians();

// [fgsfds] Rotate the sprite about the sight vector (roll)
// [fgsfds] Rotate the sprite about the sight vector (roll)
if (isWallSprite)
{
float yawvecX = Angles.Yaw.Cos();
Expand Down Expand Up @@ -489,13 +489,13 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
}
else // traditional "Y" billboard mode
{
if (doRoll || !offset.isZero() || ((di->Viewpoint.camera->ViewPos != NULL) && (di->Viewpoint.camera->ViewPos->Flags & VPSF_ISOMETRICSPRITES)))
if (doRoll || !offset.isZero())
{
mat.MakeIdentity();

if (!offset.isZero())
HandleSpriteOffsets(&mat, &HWAngles, &offset, false);

if (doRoll)
{
// Compute center of sprite
Expand All @@ -507,21 +507,11 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
mat.Translate(-center.X, -center.Z, -center.Y);
}

if ((di->Viewpoint.camera->ViewPos != NULL) && (di->Viewpoint.camera->ViewPos->Flags & VPSF_ISOMETRICSPRITES))
{
float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians();
mat.Translate(center.X, center.Z, center.Y);
mat.Translate(0.0, z2 - center.Z, 0.0);
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
mat.Translate(0.0, center.Z - z2, 0.0);
mat.Translate(-center.X, -center.Z, -center.Y);
}

v[0] = mat * FVector3(x1, z1, y1);
v[1] = mat * FVector3(x2, z1, y2);
v[2] = mat * FVector3(x1, z2, y1);
v[3] = mat * FVector3(x2, z2, y2);

}
else
{
Expand All @@ -530,14 +520,14 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
v[2] = FVector3(x1, z2, y1);
v[3] = FVector3(x2, z2, y2);
}

}
return false;
}

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -562,7 +552,7 @@ inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -587,7 +577,7 @@ void HWSprite::CreateVertices(HWDrawInfo *di)

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -626,7 +616,7 @@ void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc
}

z1=copySprite.z2=lightbottom;
vt=copySprite.vb=copySprite.vt+
vt=copySprite.vb=copySprite.vt+
(lightbottom-copySprite.z1)*(copySprite.vb-copySprite.vt)/(z2-copySprite.z1);
copySprite.PutSprite(di, translucent);
put=true;
Expand All @@ -636,7 +626,7 @@ void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -721,7 +711,7 @@ void HWSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
z1 -= difft;
}
}
if (diffb <= (0 - (float)gl_sclipthreshold)) // such a large displacement can't be correct!
if (diffb <= (0 - (float)gl_sclipthreshold)) // such a large displacement can't be correct!
{
// for living monsters standing on the floor allow a little more.
if (!(thing->flags3&MF3_ISMONSTER) || (thing->flags&MF_NOGRAVITY) || (thing->flags&MF_CORPSE) || diffb < (-1.8*(float)gl_sclipthreshold))
Expand All @@ -736,7 +726,7 @@ void HWSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down Expand Up @@ -815,7 +805,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
if (thruportal == 1) vieworigin += di->Level->Displacements.getOffset(viewmaster->Sector->PortalGroup, sector->PortalGroup);
if (fabs(vieworigin.X - vp.ActorPos.X) < 2 && fabs(vieworigin.Y - vp.ActorPos.Y) < 2) return;

// Necessary in order to prevent sprite pop-ins with viewpos and models.
// Necessary in order to prevent sprite pop-ins with viewpos and models.
auto* sec = viewmaster->Sector;
if (sec && !sec->PortalBlocksMovement(sector_t::ceiling))
{
Expand Down Expand Up @@ -910,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((di->Viewpoint.camera->ViewPos != NULL) && (di->Viewpoint.camera->ViewPos->Flags & VPSF_ISOMETRICSPRITES)) ang = vp.Angles.Yaw;
FTextureID patch;
// [ZZ] add direct picnum override
if (isPicnumOverride)
Expand Down Expand Up @@ -1030,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->Viewpoint.camera->ViewPos != NULL) && (di->Viewpoint.camera->ViewPos->Flags & VPSF_ISOMETRICSPRITES)) // 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:
Expand Down Expand Up @@ -1084,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(((di->Viewpoint.camera->ViewPos != NULL) && (di->Viewpoint.camera->ViewPos->Flags & VPSF_ISOMETRICSPRITES))) 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
Expand Down Expand Up @@ -1312,7 +1286,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t

//==========================================================================
//
//
//
//
//==========================================================================

Expand All @@ -1338,7 +1312,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
this->particle = particle;
fullbright = particle->flags & SPF_FULLBRIGHT;

if (di->isFullbrightScene())
if (di->isFullbrightScene())
{
Colormap.Clear();
}
Expand Down Expand Up @@ -1397,7 +1371,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
{
bool has_texture = particle->texture.isValid();
bool custom_animated_texture = (particle->flags & SPF_LOCAL_ANIM) && particle->animData.ok;

int particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles

// [BB] Load the texture for round or smooth particles
Expand Down Expand Up @@ -1456,7 +1430,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
float rvf = (particle->RollVel) * timefrac;
Angles.Roll = TAngle<double>::fromDeg(particle->Roll + rvf);
}

float factor;
if (particle_style == 1) factor = 1.3f / 7.f;
else if (particle_style == 2) factor = 2.5f / 7.f;
Expand All @@ -1474,7 +1448,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
z2=z+scalefac;

depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin);

// [BB] Translucent particles have to be rendered without the alpha test.
if (particle_style != 2 && trans>=1.0f-FLT_EPSILON) hw_styleflags = STYLEHW_Solid;
else hw_styleflags = STYLEHW_NoAlphaTest;
Expand All @@ -1490,7 +1464,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
}

// [MC] VisualThinkers are to be rendered akin to actor sprites. The reason this whole system
// is hitching a ride on particle_t is because of the large number of checks with
// is hitching a ride on particle_t is because of the large number of checks with
// HWSprite elsewhere in the draw lists.
void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t* sector)
{
Expand All @@ -1501,7 +1475,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t

if (paused || spr->isFrozen())
timefrac = 0.;

bool custom_anim = ((spr->PT.flags & SPF_LOCAL_ANIM) && spr->PT.animData.ok);

texture = TexMan.GetGameTexture(
Expand Down Expand Up @@ -1533,7 +1507,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t
auto r = spi.GetSpriteRect();
r.Scale(spr->Scale.X, spr->Scale.Y);

if (spr->bXFlip)
if (spr->bXFlip)
{
std::swap(ul,ur);
r.left = -r.width - r.left; // mirror the sprite's x-offset
Expand All @@ -1560,7 +1534,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t

//==========================================================================
//
//
//
//
//==========================================================================

Expand Down

1 comment on commit d8ef27e

@coelckers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you revert this much in one go, a short description why it is necessary should be added. It doesn't help anyone in the future seeing this with no reason given.

Please sign in to comment.