mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
Squashed commit of the following:
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 commitd2c2c93cf1
. 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 commitdc897eacc0
. 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 commit26908f5bc5
. 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 commit08b03e6b19
. 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 commitd3405837ce
. 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 commite171f4eb6a
. 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 commitc8a7507e8e
. 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 commit25f1407228
. 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 commit2b555d7556
. 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 commit7fbb4cd06c
. 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 commitc3ca564cfc
.
This commit is contained in:
parent
07d6b1448a
commit
d8ef27e0ed
11 changed files with 37 additions and 192 deletions
|
@ -35,7 +35,6 @@
|
|||
|
||||
#include <time.h>
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
#include "w_zip.h"
|
||||
#include "ancientzip.h"
|
||||
#include "resourcefile.h"
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2002-2016 Christoph Oelckers
|
||||
|
@ -94,7 +94,7 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -562,7 +552,7 @@ inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -587,7 +577,7 @@ void HWSprite::CreateVertices(HWDrawInfo *di)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -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;
|
||||
|
@ -636,7 +626,7 @@ void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -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))
|
||||
|
@ -736,7 +726,7 @@ void HWSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -1312,7 +1286,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
|
@ -1560,7 +1534,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
#include "i_system.h"
|
||||
#include "v_draw.h"
|
||||
#include "i_interface.h"
|
||||
#include "d_main.h"
|
||||
|
||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||
|
||||
|
@ -154,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
|
||||
|
@ -603,7 +600,7 @@ void R_InterpolateView (FRenderViewpoint &viewpoint, player_t *player, double Fr
|
|||
else break;
|
||||
}
|
||||
}
|
||||
if (moved && !viewpoint.showviewer) viewpoint.noviewer = true;
|
||||
if (moved) viewpoint.noviewer = true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -633,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;
|
||||
|
@ -865,7 +859,6 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
{
|
||||
iview->otic = nowtic;
|
||||
iview->Old = iview->New;
|
||||
viewpoint.noviewer = false;
|
||||
}
|
||||
//==============================================================================================
|
||||
// Handles offsetting the camera with ChaseCam and/or viewpos.
|
||||
|
@ -888,7 +881,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
P_AimCamera(viewpoint.camera, campos, camangle, viewpoint.sector, unlinked); // fixme: This needs to translate the angle, too.
|
||||
iview->New.Pos = campos;
|
||||
iview->New.Angles.Yaw = camangle;
|
||||
viewpoint.noviewer = false;
|
||||
|
||||
viewpoint.showviewer = true;
|
||||
// Interpolating this is a very complicated thing because nothing keeps track of the aim camera's movement, so whenever we detect a portal transition
|
||||
// it's probably best to just reset the interpolation for this move.
|
||||
|
@ -955,11 +948,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
// Interpolation still happens with everything else though and seems to work fine.
|
||||
DefaultDraw = false;
|
||||
viewpoint.NoPortalPath = true;
|
||||
// Allow VPSF_ALLOWOUTOFBOUNDS camera viewpoints to go out of bounds when using HW renderer
|
||||
if (!(VP->Flags & VPSF_ALLOWOUTOFBOUNDS) || !V_IsHardwareRenderer())
|
||||
{
|
||||
P_AdjustViewPos(mo, orig, next, viewpoint.sector, unlinked, VP, &viewpoint);
|
||||
}
|
||||
P_AdjustViewPos(mo, orig, next, viewpoint.sector, unlinked, VP, &viewpoint);
|
||||
|
||||
if (viewpoint.sector->PortalGroup != oldsector->PortalGroup || (unlinked && ((iview->New.Pos.XY() - iview->Old.Pos.XY()).LengthSquared()) > 256 * 256))
|
||||
{
|
||||
|
@ -1006,10 +995,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
viewpoint.SetViewAngle (viewwindow);
|
||||
|
||||
// Keep the view within the sector's floor and ceiling
|
||||
// But allow VPSF_ALLOWOUTOFBOUNDS camera viewpoints to go out of bounds when using hardware renderer
|
||||
bool disembodied = false;
|
||||
if (viewpoint.camera->ViewPos != NULL) disembodied = viewpoint.camera->ViewPos->Flags & VPSF_ALLOWOUTOFBOUNDS;
|
||||
if (viewpoint.sector->PortalBlocksMovement(sector_t::ceiling) && (!disembodied || !V_IsHardwareRenderer()))
|
||||
if (viewpoint.sector->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
double theZ = viewpoint.sector->ceilingplane.ZatPoint(viewpoint.Pos) - 4;
|
||||
if (viewpoint.Pos.Z > theZ)
|
||||
|
@ -1018,7 +1004,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
}
|
||||
}
|
||||
|
||||
if (viewpoint.sector->PortalBlocksMovement(sector_t::floor) && (!disembodied || !V_IsHardwareRenderer()))
|
||||
if (viewpoint.sector->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
double theZ = viewpoint.sector->floorplane.ZatPoint(viewpoint.Pos) + 4;
|
||||
if (viewpoint.Pos.Z < theZ)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1693,7 +1693,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
ACTION_RETURN_BOOL(self->IsFreelookAllowed());
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ZScript counterpart to ACS ChangeSky, uses TextureIDs
|
||||
|
|
|
@ -128,89 +128,3 @@ class AimingCamera : SecurityCamera
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class SpectatorCamera : Actor
|
||||
{
|
||||
|
||||
bool chasingtracer;
|
||||
double lagdistance; // camera gives chase (lazy follow) if tracer gets > lagdistance away from camera.pos
|
||||
int chasemode; // 0: chase until tracer centered, 1: same but only when tracer is moving, 2: stop chase if tracer within lagdistance
|
||||
property lagdistance : lagdistance;
|
||||
property chasingtracer : chasingtracer;
|
||||
property chasemode : chasemode;
|
||||
|
||||
default
|
||||
{
|
||||
+NOBLOCKMAP
|
||||
+NOGRAVITY
|
||||
+NOSECTOR
|
||||
+NOINTERACTION
|
||||
RenderStyle "None";
|
||||
CameraHeight 0;
|
||||
SpectatorCamera.chasingtracer false;
|
||||
SpectatorCamera.lagdistance 0.0;
|
||||
SpectatorCamera.chasemode 0;
|
||||
}
|
||||
|
||||
void Init(double dist, double yaw, double inpitch, int inflags)
|
||||
{
|
||||
if(((inflags > 0) && (inflags & VPSF_ORTHOGRAPHIC)) || ((inflags < 0) && (ViewPos.Flags & VPSF_ORTHOGRAPHIC))) dist *= 3.0;
|
||||
|
||||
double zshift = 0.0;
|
||||
if(tracer != NULL)
|
||||
{
|
||||
if(player != NULL) zshift = -0.5*tracer.height;
|
||||
else zshift = 0.5*tracer.height;
|
||||
}
|
||||
else if (player != NULL && player.mo != NULL) zshift = -0.5*player.mo.height;
|
||||
|
||||
SetViewPos((-dist*Cos(yaw), -dist*Sin(yaw), dist*Tan(inpitch)+zshift), inflags);
|
||||
LookAtSelf(inpitch);
|
||||
}
|
||||
|
||||
void LookAtSelf(double inpitch)
|
||||
{
|
||||
if(ViewPos.Offset != (0., 0., 0.))
|
||||
{
|
||||
Vector3 negviewpos = (-1.0) * ViewPos.Offset;
|
||||
angle = negviewpos.Angle();
|
||||
pitch = inpitch;
|
||||
}
|
||||
}
|
||||
|
||||
override void Tick()
|
||||
{
|
||||
if(tracer != NULL)
|
||||
{
|
||||
Vector3 distvec = tracer.pos - pos;
|
||||
double dist = distvec.length();
|
||||
if((dist <= 4 && chasingtracer) || lagdistance <= 0.0) // Keep tracer centered on screen
|
||||
{
|
||||
SetOrigin(tracer.pos, true);
|
||||
chasingtracer = false;
|
||||
}
|
||||
else // Lazy follow tracer
|
||||
{
|
||||
if(dist >= 2*lagdistance)
|
||||
{
|
||||
SetOrigin(tracer.pos, true);
|
||||
chasingtracer = false;
|
||||
}
|
||||
else if(dist > lagdistance && !chasingtracer) chasingtracer = true;
|
||||
|
||||
if(chasingtracer)
|
||||
{
|
||||
speed = tracer.vel.xy.length()/dist;
|
||||
if((speed == 0.0) && (chasemode == 0)) speed = tracer.speed/dist;
|
||||
SetOrigin(pos + 2*distvec*speed, true);
|
||||
if(chasemode > 1) chasingtracer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(player != NULL && player.mo != NULL)
|
||||
{
|
||||
cameraFOV = player.FOV;
|
||||
SetOrigin(player.mo.pos, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,9 +420,6 @@ enum EViewPosFlags
|
|||
{
|
||||
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).
|
||||
};
|
||||
|
||||
// Flags for A_TakeInventory and A_TakeFromTarget
|
||||
|
|
Loading…
Reference in a new issue