mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- made R_SetViewAngle a member of r_viewpoint
This commit is contained in:
parent
2c655322c3
commit
753cd0aede
5 changed files with 20 additions and 14 deletions
|
@ -148,12 +148,13 @@ void GLSceneDrawer::Set3DViewport(bool mainview)
|
||||||
|
|
||||||
void GLSceneDrawer::SetViewAngle(DAngle viewangle)
|
void GLSceneDrawer::SetViewAngle(DAngle viewangle)
|
||||||
{
|
{
|
||||||
|
FRenderViewpoint &vp = r_viewpoint;
|
||||||
GLRenderer->mAngles.Yaw = float(270.0-viewangle.Degrees);
|
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.X = v.X;
|
||||||
GLRenderer->mViewVector.Y = v.Y;
|
GLRenderer->mViewVector.Y = v.Y;
|
||||||
|
|
||||||
R_SetViewAngle(r_viewpoint, r_viewwindow);
|
vp.SetViewAngle(r_viewwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ void PolyDrawSectorPortal::SaveGlobals()
|
||||||
|
|
||||||
viewpoint.camera = nullptr;
|
viewpoint.camera = nullptr;
|
||||||
viewpoint.sector = Portal->mDestination;
|
viewpoint.sector = Portal->mDestination;
|
||||||
R_SetViewAngle(viewpoint, viewwindow);
|
viewpoint.SetViewAngle(viewwindow);
|
||||||
|
|
||||||
Portal->mFlags |= PORTSF_INSKYBOX;
|
Portal->mFlags |= PORTSF_INSKYBOX;
|
||||||
if (Portal->mPartner > 0) level.sectorPortals[Portal->mPartner].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);
|
//PolyRenderer::Instance()->Light.SetVisibility(savedvisibility);
|
||||||
|
|
||||||
R_SetViewAngle(viewpoint, viewwindow);
|
viewpoint.SetViewAngle(viewwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -236,7 +236,7 @@ void PolyDrawLinePortal::SaveGlobals()
|
||||||
viewpoint.camera = nullptr;
|
viewpoint.camera = nullptr;
|
||||||
viewpoint.sector = R_PointInSubsector(viewpoint.Pos)->sector;
|
viewpoint.sector = R_PointInSubsector(viewpoint.Pos)->sector;
|
||||||
|
|
||||||
R_SetViewAngle(viewpoint, viewwindow);
|
viewpoint.SetViewAngle(viewwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyDrawLinePortal::RestoreGlobals()
|
void PolyDrawLinePortal::RestoreGlobals()
|
||||||
|
@ -254,5 +254,5 @@ void PolyDrawLinePortal::RestoreGlobals()
|
||||||
viewpoint.camera->renderflags &= ~RF_INVISIBLE;
|
viewpoint.camera->renderflags &= ~RF_INVISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SetViewAngle(viewpoint, viewwindow);
|
viewpoint.SetViewAngle(viewwindow);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
Sin = Angles.Yaw.Sin();
|
||||||
viewpoint.Cos = viewpoint.Angles.Yaw.Cos();
|
Cos = Angles.Yaw.Cos();
|
||||||
|
|
||||||
viewpoint.TanSin = viewwindow.FocalTangent * viewpoint.Sin;
|
TanSin = viewwindow.FocalTangent * Sin;
|
||||||
viewpoint.TanCos = viewwindow.FocalTangent * viewpoint.Cos;
|
TanCos = viewwindow.FocalTangent * Cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -844,7 +844,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
||||||
}
|
}
|
||||||
R_InterpolateView (viewpoint, player, viewpoint.TicFrac, iview);
|
R_InterpolateView (viewpoint, player, viewpoint.TicFrac, iview);
|
||||||
|
|
||||||
R_SetViewAngle (viewpoint, viewwindow);
|
viewpoint.SetViewAngle (viewwindow);
|
||||||
|
|
||||||
interpolator.DoInterpolations (viewpoint.TicFrac);
|
interpolator.DoInterpolations (viewpoint.TicFrac);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "vectors.h"
|
#include "vectors.h"
|
||||||
|
|
||||||
class FSerializer;
|
class FSerializer;
|
||||||
|
struct FViewWindow;
|
||||||
//
|
//
|
||||||
// Stuff from r_main.h that's needed outside the rendering code.
|
// 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
|
int extralight; // extralight to be added to this viewpoint
|
||||||
bool showviewer; // show the camera actor?
|
bool showviewer; // show the camera actor?
|
||||||
|
|
||||||
|
|
||||||
|
void SetViewAngle(const FViewWindow &viewwindow);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FRenderViewpoint r_viewpoint;
|
extern FRenderViewpoint r_viewpoint;
|
||||||
|
|
|
@ -172,7 +172,7 @@ namespace swrenderer
|
||||||
Thread->Viewport->viewpoint.camera = nullptr;
|
Thread->Viewport->viewpoint.camera = nullptr;
|
||||||
Thread->Viewport->viewpoint.sector = port->mDestination;
|
Thread->Viewport->viewpoint.sector = port->mDestination;
|
||||||
assert(Thread->Viewport->viewpoint.sector != nullptr);
|
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->Viewport->SetupPolyViewport(Thread);
|
||||||
Thread->OpaquePass->ClearSeenSprites();
|
Thread->OpaquePass->ClearSeenSprites();
|
||||||
Thread->Clip3D->ClearFakeFloors();
|
Thread->Clip3D->ClearFakeFloors();
|
||||||
|
@ -260,7 +260,7 @@ namespace swrenderer
|
||||||
Thread->Light->SetVisibility(Thread->Viewport.get(), savedvisibility);
|
Thread->Light->SetVisibility(Thread->Viewport.get(), savedvisibility);
|
||||||
Thread->Viewport->viewpoint.extralight = savedextralight;
|
Thread->Viewport->viewpoint.extralight = savedextralight;
|
||||||
Thread->Viewport->viewpoint.Angles = savedangles;
|
Thread->Viewport->viewpoint.Angles = savedangles;
|
||||||
R_SetViewAngle(Thread->Viewport->viewpoint, Thread->Viewport->viewwindow);
|
Thread->Viewport->viewpoint.SetViewAngle(Thread->Viewport->viewwindow);
|
||||||
Thread->Viewport->SetupPolyViewport(Thread);
|
Thread->Viewport->SetupPolyViewport(Thread);
|
||||||
|
|
||||||
CurrentPortalInSkybox = false;
|
CurrentPortalInSkybox = false;
|
||||||
|
|
Loading…
Reference in a new issue