- made R_SetViewAngle a member of r_viewpoint

This commit is contained in:
Christoph Oelckers 2018-06-19 17:44:11 +02:00
parent 2c655322c3
commit 753cd0aede
5 changed files with 20 additions and 14 deletions

View file

@ -148,12 +148,13 @@ void GLSceneDrawer::Set3DViewport(bool mainview)
void GLSceneDrawer::SetViewAngle(DAngle viewangle)
{
FRenderViewpoint &vp = r_viewpoint;
GLRenderer->mAngles.Yaw = float(270.0-viewangle.Degrees);
DVector2 v = r_viewpoint.Angles.Yaw.ToVector();
DVector2 v = vp.Angles.Yaw.ToVector();
GLRenderer->mViewVector.X = v.X;
GLRenderer->mViewVector.Y = v.Y;
R_SetViewAngle(r_viewpoint, r_viewwindow);
vp.SetViewAngle(r_viewwindow);
}

View file

@ -88,7 +88,7 @@ void PolyDrawSectorPortal::SaveGlobals()
viewpoint.camera = nullptr;
viewpoint.sector = Portal->mDestination;
R_SetViewAngle(viewpoint, viewwindow);
viewpoint.SetViewAngle(viewwindow);
Portal->mFlags |= PORTSF_INSKYBOX;
if (Portal->mPartner > 0) level.sectorPortals[Portal->mPartner].mFlags |= PORTSF_INSKYBOX;
@ -114,7 +114,7 @@ void PolyDrawSectorPortal::RestoreGlobals()
//PolyRenderer::Instance()->Light.SetVisibility(savedvisibility);
R_SetViewAngle(viewpoint, viewwindow);
viewpoint.SetViewAngle(viewwindow);
}
/////////////////////////////////////////////////////////////////////////////
@ -236,7 +236,7 @@ void PolyDrawLinePortal::SaveGlobals()
viewpoint.camera = nullptr;
viewpoint.sector = R_PointInSubsector(viewpoint.Pos)->sector;
R_SetViewAngle(viewpoint, viewwindow);
viewpoint.SetViewAngle(viewwindow);
}
void PolyDrawLinePortal::RestoreGlobals()
@ -254,5 +254,5 @@ void PolyDrawLinePortal::RestoreGlobals()
viewpoint.camera->renderflags &= ~RF_INVISIBLE;
}
R_SetViewAngle(viewpoint, viewwindow);
viewpoint.SetViewAngle(viewwindow);
}

View file

@ -602,13 +602,13 @@ void R_ResetViewInterpolation ()
//
//==========================================================================
void R_SetViewAngle (FRenderViewpoint &viewpoint, const FViewWindow &viewwindow)
void FRenderViewpoint::SetViewAngle (const FViewWindow &viewwindow)
{
viewpoint.Sin = viewpoint.Angles.Yaw.Sin();
viewpoint.Cos = viewpoint.Angles.Yaw.Cos();
Sin = Angles.Yaw.Sin();
Cos = Angles.Yaw.Cos();
viewpoint.TanSin = viewwindow.FocalTangent * viewpoint.Sin;
viewpoint.TanCos = viewwindow.FocalTangent * viewpoint.Cos;
TanSin = viewwindow.FocalTangent * Sin;
TanCos = viewwindow.FocalTangent * Cos;
}
//==========================================================================
@ -844,7 +844,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
}
R_InterpolateView (viewpoint, player, viewpoint.TicFrac, iview);
R_SetViewAngle (viewpoint, viewwindow);
viewpoint.SetViewAngle (viewwindow);
interpolator.DoInterpolations (viewpoint.TicFrac);

View file

@ -5,6 +5,7 @@
#include "vectors.h"
class FSerializer;
struct FViewWindow;
//
// Stuff from r_main.h that's needed outside the rendering code.
@ -36,6 +37,10 @@ struct FRenderViewpoint
int extralight; // extralight to be added to this viewpoint
bool showviewer; // show the camera actor?
void SetViewAngle(const FViewWindow &viewwindow);
};
extern FRenderViewpoint r_viewpoint;

View file

@ -172,7 +172,7 @@ namespace swrenderer
Thread->Viewport->viewpoint.camera = nullptr;
Thread->Viewport->viewpoint.sector = port->mDestination;
assert(Thread->Viewport->viewpoint.sector != nullptr);
R_SetViewAngle(Thread->Viewport->viewpoint, Thread->Viewport->viewwindow);
Thread->Viewport->viewpoint.SetViewAngle(Thread->Viewport->viewwindow);
Thread->Viewport->SetupPolyViewport(Thread);
Thread->OpaquePass->ClearSeenSprites();
Thread->Clip3D->ClearFakeFloors();
@ -260,7 +260,7 @@ namespace swrenderer
Thread->Light->SetVisibility(Thread->Viewport.get(), savedvisibility);
Thread->Viewport->viewpoint.extralight = savedextralight;
Thread->Viewport->viewpoint.Angles = savedangles;
R_SetViewAngle(Thread->Viewport->viewpoint, Thread->Viewport->viewwindow);
Thread->Viewport->viewpoint.SetViewAngle(Thread->Viewport->viewwindow);
Thread->Viewport->SetupPolyViewport(Thread);
CurrentPortalInSkybox = false;