From e7531bb57960258ce20ab0678e28f639e215047b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 Jun 2018 21:44:53 +0200 Subject: [PATCH] - fixed camerapos setup. --- src/gl/scene/gl_drawinfo.h | 2 +- src/gl/scene/gl_portal.cpp | 14 +++++++------- src/gl/scene/gl_scene.cpp | 7 +++---- src/gl/scene/gl_skydome.cpp | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/gl/scene/gl_drawinfo.h b/src/gl/scene/gl_drawinfo.h index cd37b4552..2859be999 100644 --- a/src/gl/scene/gl_drawinfo.h +++ b/src/gl/scene/gl_drawinfo.h @@ -114,7 +114,7 @@ struct FDrawInfo : public HWDrawInfo // These should go into hwrenderer later. void SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mirror, bool planemirror); - void SetupView(float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror); + void SetupView(float vx, float vy, float vz, bool mirror, bool planemirror); static FDrawInfo *StartDrawInfo(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms); diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 1c3b7c3b1..22687eaa7 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -316,7 +316,7 @@ void GLPortal::End(FDrawInfo *di, bool usestencil) // Restore the old view if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); { ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0, 0, 0, 0); // no graphics @@ -370,7 +370,7 @@ void GLPortal::End(FDrawInfo *di, bool usestencil) // Restore the old view if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); // This draws a valid z-buffer into the stencil's contents to ensure it // doesn't get overwritten by the level's geometry. @@ -577,7 +577,7 @@ void GLSkyboxPortal::DrawContents(FDrawInfo *di) vp.ViewActor = origin; inskybox = true; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); di->SetViewArea(); ClearClipper(di); @@ -684,7 +684,7 @@ void GLSectorStackPortal::DrawContents(FDrawInfo *di) // avoid recursions! if (origin->plane != -1) screen->instack[origin->plane]++; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); SetupCoverage(di); ClearClipper(di); @@ -740,7 +740,7 @@ void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di) PlaneMirrorMode = origin->fC() < 0 ? -1 : 1; PlaneMirrorFlag++; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); ClearClipper(di); di->UpdateCurrentMapSection(); @@ -911,7 +911,7 @@ void GLMirrorPortal::DrawContents(FDrawInfo *di) vp.ViewActor = nullptr; MirrorFlag++; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); di->mClipper->Clear(); @@ -988,7 +988,7 @@ void GLLineToLinePortal::DrawContents(FDrawInfo *di) } vp.ViewActor = nullptr; - di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); ClearClipper(di); gl_RenderState.SetClipLine(glport->lines[0]->mDestination); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 7db0911ed..72f3d8915 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -104,7 +104,7 @@ void FDrawInfo::SetViewMatrix(const FRotator &angles, float vx, float vy, float // Setup the view rotation matrix for the given viewpoint // //----------------------------------------------------------------------------- -void FDrawInfo::SetupView(float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror) +void FDrawInfo::SetupView(float vx, float vy, float vz, bool mirror, bool planemirror) { auto &vp = Viewpoint; vp.SetViewAngle(r_viewwindow); @@ -506,12 +506,11 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came // Stereo mode specific perspective projection di->VPUniforms.mProjectionMatrix = eye->GetProjection(fov, ratio, fovratio); - vp.SetViewAngle(r_viewwindow); // Stereo mode specific viewpoint adjustment - temporarily shifts global ViewPos eye->GetViewShift(vp.HWAngles.Yaw.Degrees, viewShift); ScopedViewShifter viewShifter(vp.Pos, viewShift); - di->SetViewMatrix(vp.HWAngles, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false); - di->ApplyVPUniforms(); + di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false); + di->ProcessScene(toscreen); diff --git a/src/gl/scene/gl_skydome.cpp b/src/gl/scene/gl_skydome.cpp index 52db58670..9f3ef2bd7 100644 --- a/src/gl/scene/gl_skydome.cpp +++ b/src/gl/scene/gl_skydome.cpp @@ -230,7 +230,7 @@ void GLSkyPortal::DrawContents(FDrawInfo *di) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); bool oldClamp = gl_RenderState.SetDepthClamp(true); - di->SetupView(0, 0, 0, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); + di->SetupView(0, 0, 0, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1)); gl_RenderState.SetVertexBuffer(GLRenderer->mSkyVBO); if (origin->texture[0] && origin->texture[0]->tex->bSkybox)